Aggiunto progetto GPW_Data

This commit is contained in:
Samuele E. Locatelli
2016-11-09 15:04:25 +01:00
parent 5af27778ec
commit ffd3ea1edc
60 changed files with 86926 additions and 0 deletions
+30126
View File
File diff suppressed because it is too large Load Diff
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--<autogenerated>
This code was generated by a tool.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
</autogenerated>-->
<DataSetUISetting Version="1.00" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TableUISettings />
</DataSetUISetting>
File diff suppressed because it is too large Load Diff
+111
View File
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<!--<autogenerated>
This code was generated by a tool to store the dataset designer's layout information.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
</autogenerated>-->
<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="-10" ViewPortY="650" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
<Shapes>
<Shape ID="DesignTable:Timbrature" ZOrder="24" X="279" Y="76" Height="345" Width="241" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="140" />
<Shape ID="DesignTable:TimbratureExpl" ZOrder="14" X="604" Y="119" Height="381" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:AnagDevices" ZOrder="17" X="937" Y="134" Height="324" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="178" />
<Shape ID="DesignTable:Dipendenti" ZOrder="5" X="279" Y="478" Height="533" Width="244" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="311" />
<Shape ID="DesignTable:AnagClienti" ZOrder="7" X="1234" Y="528" Height="438" Width="266" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="311" />
<Shape ID="DesignTable:AnagProgetti" ZOrder="1" X="886" Y="976" Height="440" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="256" />
<Shape ID="DesignTable:Dipendenti2Ruoli" ZOrder="23" X="579" Y="943" Height="153" Width="225" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
<Shape ID="DesignTable:AnagFasi" ZOrder="10" X="871" Y="528" Height="381" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:v_logCommUt" ZOrder="8" X="1204" Y="1309" Height="324" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:RegAttivita" ZOrder="2" X="584" Y="591" Height="305" Width="230" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="178" />
<Shape ID="DesignTable:CalendFesteFerie" ZOrder="19" X="584" Y="1151" Height="115" Width="242" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
<Shape ID="DesignTable:AnagOrari" ZOrder="12" X="278" Y="1055" Height="343" Width="238" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:TimbMeseExpl" ZOrder="16" X="1249" Y="134" Height="343" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="273" />
<Shape ID="DesignTable:Giustificativi" ZOrder="15" X="564" Y="1326" Height="229" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="102" />
<Shape ID="DesignTable:stp_DipendentiAndAnomalie" ZOrder="13" X="82" Y="1313" Height="134" Width="158" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="83" />
<Shape ID="DesignTable:TE_RA_Expl" ZOrder="4" X="-3" Y="176" Height="704" Width="249" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="636" />
<Shape ID="DesignTable:regAttDayExpl" ZOrder="9" X="19" Y="886" Height="381" Width="244" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="254" />
<Shape ID="DesignTable:AnagProgetti_Expl" ZOrder="6" X="1236" Y="992" Height="286" Width="258" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="235" />
<Shape ID="DesignTable:RegistroEventi" ZOrder="3" X="85" Y="1476" Height="153" Width="209" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="83" />
</Shapes>
<Connectors>
<Connector ID="DesignRelation:FK_Timbrature_Dipendenti" ZOrder="25" LineWidth="11">
<RoutePoints>
<Point>
<X>385</X>
<Y>478</Y>
</Point>
<Point>
<X>385</X>
<Y>421</Y>
</Point>
</RoutePoints>
</Connector>
<Connector ID="DesignRelation:FK_AnagProgetti_AnagClienti" ZOrder="11" LineWidth="11">
<RoutePoints>
<Point>
<X>1234</X>
<Y>947</Y>
</Point>
<Point>
<X>1216</X>
<Y>947</Y>
</Point>
<Point>
<X>1216</X>
<Y>1002</Y>
</Point>
<Point>
<X>1186</X>
<Y>1002</Y>
</Point>
</RoutePoints>
</Connector>
<Connector ID="DesignRelation:FK_AnagFasi_AnagProgetti" ZOrder="22" LineWidth="11">
<RoutePoints>
<Point>
<X>1008</X>
<Y>976</Y>
</Point>
<Point>
<X>1008</X>
<Y>909</Y>
</Point>
</RoutePoints>
</Connector>
<Connector ID="DesignRelation:FK_RegAttivita_AnagFasi" ZOrder="21" LineWidth="11">
<RoutePoints>
<Point>
<X>871</X>
<Y>649</Y>
</Point>
<Point>
<X>814</X>
<Y>649</Y>
</Point>
</RoutePoints>
</Connector>
<Connector ID="DesignRelation:FK_RegAttivita_Dipendenti" ZOrder="20" LineWidth="11">
<RoutePoints>
<Point>
<X>523</X>
<Y>628</Y>
</Point>
<Point>
<X>584</X>
<Y>628</Y>
</Point>
</RoutePoints>
</Connector>
<Connector ID="DesignRelation:FK_Dipendenti_AnagOrari" ZOrder="18" LineWidth="11">
<RoutePoints>
<Point>
<X>324</X>
<Y>1055</Y>
</Point>
<Point>
<X>324</X>
<Y>1011</Y>
</Point>
</RoutePoints>
</Connector>
</Connectors>
</DiagramLayout>
+11521
View File
File diff suppressed because it is too large Load Diff
+14
View File
@@ -0,0 +1,14 @@
namespace GPW_data
{
public partial class DS_Utility
{
}
}
namespace GPW_data {
public partial class DS_Utility {
}
}
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--<autogenerated>
This code was generated by a tool.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
</autogenerated>-->
<DataSetUISetting Version="1.00" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TableUISettings />
</DataSetUISetting>
+779
View File
@@ -0,0 +1,779 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="DS_Utility" targetNamespace="http://tempuri.org/DS_Utility.xsd" xmlns:mstns="http://tempuri.org/DS_Utility.xsd" xmlns="http://tempuri.org/DS_Utility.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:annotation>
<xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
<DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<Connections>
<Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="GPWConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="GPWConnectionString (Settings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.GPW_data.Properties.Settings.GlobalReference.Default.GPWConnectionString" Provider="System.Data.SqlClient" />
</Connections>
<Tables>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selDipendentiTableAdapter" GeneratorDataComponentClassName="v_selDipendentiTableAdapter" Name="v_selDipendenti" UserDataComponentName="v_selDipendentiTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.v_selDipendenti" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="true">
<CommandText>SELECT value, label
FROM v_selDipendenti
ORDER BY label</CommandText>
<Parameters />
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="value" DataSetColumn="value" />
<Mapping SourceColumn="label" DataSetColumn="label" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="stp_getLastDaysTableAdapter" GeneratorDataComponentClassName="stp_getLastDaysTableAdapter" Name="stp_getLastDays" UserDataComponentName="stp_getLastDaysTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.stp_getLastDays" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_getLastDays</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@lastDate" Precision="23" ProviderType="DateTime" Scale="3" Size="8" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@numD" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="Data" DataSetColumn="Data" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="stp_getMinTableAdapter" GeneratorDataComponentClassName="stp_getMinTableAdapter" Name="stp_getMin" UserDataComponentName="stp_getMinTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.stp_getMin" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_getMin</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@interv" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="minuto" DataSetColumn="minuto" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="stp_getHoursTableAdapter" GeneratorDataComponentClassName="stp_getHoursTableAdapter" Name="stp_getHours" UserDataComponentName="stp_getHoursTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.stp_getHours" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_getHours</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="ora" DataSetColumn="ora" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selProgettiTableAdapter" GeneratorDataComponentClassName="v_selProgettiTableAdapter" Name="v_selProgetti" UserDataComponentName="v_selProgettiTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.v_selProgetti" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="true">
<CommandText>SELECT * FROM v_selProgetti</CommandText>
<Parameters />
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="value" DataSetColumn="value" />
<Mapping SourceColumn="label" DataSetColumn="label" />
<Mapping SourceColumn="conditio" DataSetColumn="conditio" />
<Mapping SourceColumn="Attivo" DataSetColumn="Attivo" />
</Mappings>
<Sources>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.stp_VSPrj_byConditio" DbObjectType="StoredProcedure" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="getByConditio" GetMethodModifier="Public" GetMethodName="getByConditio" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="getByConditio" UserSourceName="getByConditio">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_VSPrj_byConditio</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@conditio" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@soloAttivi" Precision="1" ProviderType="Bit" Scale="0" Size="1" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.stp_VSPrj" DbObjectType="StoredProcedure" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="getGrouped" GetMethodModifier="Public" GetMethodName="getGrouped" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="getGrouped" UserSourceName="getGrouped">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_VSPrj</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@soloAttivi" Precision="1" ProviderType="Bit" Scale="0" Size="1" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</Sources>
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selFasiTableAdapter" GeneratorDataComponentClassName="v_selFasiTableAdapter" Name="v_selFasi" UserDataComponentName="v_selFasiTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.v_selFasi" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="true">
<CommandText>SELECT value, label, conditio FROM v_selFasi</CommandText>
<Parameters />
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="value" DataSetColumn="value" />
<Mapping SourceColumn="label" DataSetColumn="label" />
<Mapping SourceColumn="conditio" DataSetColumn="conditio" />
</Mappings>
<Sources>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.stp_VSFasi_ByPrj" DbObjectType="StoredProcedure" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="getByConditio" GetMethodModifier="Public" GetMethodName="getByConditio" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="getByConditio" UserSourceName="getByConditio">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_VSFasi_ByPrj</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@conditio" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@soloAttivi" Precision="1" ProviderType="Bit" Scale="0" Size="1" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</Sources>
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selClientiTableAdapter" GeneratorDataComponentClassName="v_selClientiTableAdapter" Name="v_selClienti" UserDataComponentName="v_selClientiTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.v_selClienti" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="true">
<CommandText>SELECT value, label
FROM v_selClienti
ORDER BY label</CommandText>
<Parameters />
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="value" DataSetColumn="value" />
<Mapping SourceColumn="label" DataSetColumn="label" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="stp_statsProjTableAdapter" GeneratorDataComponentClassName="stp_statsProjTableAdapter" Name="stp_statsProj" UserDataComponentName="stp_statsProjTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.stp_statsProj" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_statsProj</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@idxProgetto" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="oreBudget" DataSetColumn="oreBudget" />
<Mapping SourceColumn="oreTot" DataSetColumn="oreTot" />
<Mapping SourceColumn="oreMese" DataSetColumn="oreMese" />
<Mapping SourceColumn="oreMesePrec" DataSetColumn="oreMesePrec" />
<Mapping SourceColumn="Attivo" DataSetColumn="Attivo" />
<Mapping SourceColumn="starred" DataSetColumn="starred" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selCodGiustTableAdapter" GeneratorDataComponentClassName="v_selCodGiustTableAdapter" Name="v_selCodGiust" UserDataComponentName="v_selCodGiustTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.v_selCodGiust" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>SELECT value, label FROM dbo.v_selCodGiust</CommandText>
<Parameters />
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="value" DataSetColumn="value" />
<Mapping SourceColumn="label" DataSetColumn="label" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="nextValContatoreTableAdapter" GeneratorDataComponentClassName="nextValContatoreTableAdapter" Name="nextValContatore" UserDataComponentName="nextValContatoreTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.stp_nextValContatore" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_nextValContatore</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@codContatore" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="Column1" DataSetColumn="Column1" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selFasiOptTableAdapter" GeneratorDataComponentClassName="v_selFasiOptTableAdapter" Name="v_selFasiOpt" UserDataComponentName="v_selFasiOptTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.stp_VSFasiOpt_ByPrj" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="getByConditio" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="getByConditio" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="getByConditio" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_VSFasiOpt_ByPrj</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@conditio" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="bit" DbType="Boolean" Direction="Input" ParameterName="@soloAttivi" Precision="1" ProviderType="Bit" Scale="0" Size="1" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="valueGroup" DataSetColumn="valueGroup" />
<Mapping SourceColumn="value" DataSetColumn="value" />
<Mapping SourceColumn="label" DataSetColumn="label" />
<Mapping SourceColumn="conditio" DataSetColumn="conditio" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="AnagKeyValueTableAdapter" GeneratorDataComponentClassName="AnagKeyValueTableAdapter" Name="AnagKeyValue" UserDataComponentName="AnagKeyValueTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.AnagKeyValue" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<DeleteCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>DELETE FROM [dbo].[AnagKeyValue] WHERE (([nomeVar] = @Original_nomeVar) AND ((@IsNull_valInt = 1 AND [valInt] IS NULL) OR ([valInt] = @Original_valInt)) AND ((@IsNull_valFloat = 1 AND [valFloat] IS NULL) OR ([valFloat] = @Original_valFloat)) AND ((@IsNull_valString = 1 AND [valString] IS NULL) OR ([valString] = @Original_valString)) AND ((@IsNull_descrizione = 1 AND [descrizione] IS NULL) OR ([descrizione] = @Original_descrizione)))</CommandText>
<Parameters>
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_nomeVar" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="nomeVar" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_valInt" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="valInt" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Original_valInt" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="valInt" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_valFloat" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="valFloat" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Double" Direction="Input" ParameterName="@Original_valFloat" Precision="0" ProviderType="Float" Scale="0" Size="0" SourceColumn="valFloat" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_valString" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="valString" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_valString" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="valString" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_descrizione" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="descrizione" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_descrizione" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="descrizione" SourceColumnNullMapping="false" SourceVersion="Original" />
</Parameters>
</DbCommand>
</DeleteCommand>
<InsertCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>INSERT INTO [dbo].[AnagKeyValue] ([nomeVar], [valInt], [valFloat], [valString], [descrizione]) VALUES (@nomeVar, @valInt, @valFloat, @valString, @descrizione);
SELECT nomeVar, valInt, valFloat, valString, descrizione FROM AnagKeyValue WHERE (nomeVar = @nomeVar)</CommandText>
<Parameters>
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@nomeVar" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="nomeVar" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@valInt" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="valInt" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Double" Direction="Input" ParameterName="@valFloat" Precision="0" ProviderType="Float" Scale="0" Size="0" SourceColumn="valFloat" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@valString" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="valString" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@descrizione" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="descrizione" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</InsertCommand>
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>SELECT nomeVar, valInt, valFloat, valString, descrizione FROM dbo.AnagKeyValue</CommandText>
<Parameters />
</DbCommand>
</SelectCommand>
<UpdateCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>UPDATE [dbo].[AnagKeyValue] SET [nomeVar] = @nomeVar, [valInt] = @valInt, [valFloat] = @valFloat, [valString] = @valString, [descrizione] = @descrizione WHERE (([nomeVar] = @Original_nomeVar) AND ((@IsNull_valInt = 1 AND [valInt] IS NULL) OR ([valInt] = @Original_valInt)) AND ((@IsNull_valFloat = 1 AND [valFloat] IS NULL) OR ([valFloat] = @Original_valFloat)) AND ((@IsNull_valString = 1 AND [valString] IS NULL) OR ([valString] = @Original_valString)) AND ((@IsNull_descrizione = 1 AND [descrizione] IS NULL) OR ([descrizione] = @Original_descrizione)));
SELECT nomeVar, valInt, valFloat, valString, descrizione FROM AnagKeyValue WHERE (nomeVar = @nomeVar)</CommandText>
<Parameters>
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@nomeVar" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="nomeVar" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@valInt" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="valInt" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Double" Direction="Input" ParameterName="@valFloat" Precision="0" ProviderType="Float" Scale="0" Size="0" SourceColumn="valFloat" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@valString" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="valString" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@descrizione" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="descrizione" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_nomeVar" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="nomeVar" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_valInt" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="valInt" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Original_valInt" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="valInt" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_valFloat" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="valFloat" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Double" Direction="Input" ParameterName="@Original_valFloat" Precision="0" ProviderType="Float" Scale="0" Size="0" SourceColumn="valFloat" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_valString" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="valString" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_valString" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="valString" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_descrizione" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="descrizione" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_descrizione" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="descrizione" SourceColumnNullMapping="false" SourceVersion="Original" />
</Parameters>
</DbCommand>
</UpdateCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="nomeVar" DataSetColumn="nomeVar" />
<Mapping SourceColumn="valInt" DataSetColumn="valInt" />
<Mapping SourceColumn="valFloat" DataSetColumn="valFloat" />
<Mapping SourceColumn="valString" DataSetColumn="valString" />
<Mapping SourceColumn="descrizione" DataSetColumn="descrizione" />
</Mappings>
<Sources>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.stp_AKV_getByKey" DbObjectType="StoredProcedure" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="getByKey" GetMethodModifier="Public" GetMethodName="getByKey" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="getByKey" UserSourceName="getByKey">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_AKV_getByKey</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@nomeVar" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</Sources>
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selCodOrarioTableAdapter" GeneratorDataComponentClassName="v_selCodOrarioTableAdapter" Name="v_selCodOrario" UserDataComponentName="v_selCodOrarioTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.v_selCodOrario" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>SELECT value, label FROM dbo.v_selCodOrario</CommandText>
<Parameters />
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="value" DataSetColumn="value" />
<Mapping SourceColumn="label" DataSetColumn="label" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selPageSizeTableAdapter" GeneratorDataComponentClassName="v_selPageSizeTableAdapter" Name="v_selPageSize" UserDataComponentName="v_selPageSizeTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.v_selPageSize" DbObjectType="View" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="true">
<CommandText>SELECT value, label, ordinal
FROM v_selPageSize
ORDER BY ordinal</CommandText>
<Parameters />
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="value" DataSetColumn="value" />
<Mapping SourceColumn="label" DataSetColumn="label" />
<Mapping SourceColumn="ordinal" DataSetColumn="ordinal" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="stp_VSProjFasi_searchTableAdapter" GeneratorDataComponentClassName="stp_VSProjFasi_searchTableAdapter" Name="stp_VSProjFasi_search" UserDataComponentName="stp_VSProjFasi_searchTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.stp_VSProjFasi_search" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_VSProjFasi_search</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@textSearch" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="idxProgetto" DataSetColumn="idxProgetto" />
<Mapping SourceColumn="idxFase" DataSetColumn="idxFase" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="freqProgettiTableAdapter" GeneratorDataComponentClassName="freqProgettiTableAdapter" Name="freqProgetti" UserDataComponentName="freqProgettiTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.stp_freqProjByDipPeriodo" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_freqProjByDipPeriodo</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@idxDipendente" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@inizio" Precision="23" ProviderType="DateTime" Scale="3" Size="8" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@fine" Precision="23" ProviderType="DateTime" Scale="3" Size="8" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@maxRes" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="nomeComm" DataSetColumn="nomeComm" />
<Mapping SourceColumn="idxFaseComm" DataSetColumn="idxFaseComm" />
<Mapping SourceColumn="idxFase" DataSetColumn="idxFase" />
<Mapping SourceColumn="nomeProj" DataSetColumn="nomeProj" />
<Mapping SourceColumn="nomeFase" DataSetColumn="nomeFase" />
<Mapping SourceColumn="freq" DataSetColumn="freq" />
<Mapping SourceColumn="qty" DataSetColumn="qty" />
<Mapping SourceColumn="tot" DataSetColumn="tot" />
<Mapping SourceColumn="RowNum" DataSetColumn="RowNum" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="v_selProjFasiTableAdapter" GeneratorDataComponentClassName="v_selProjFasiTableAdapter" Name="v_selProjFasi" UserDataComponentName="v_selProjFasiTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.stp_VSPF_search" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_VSPF_search</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@search" Precision="0" ProviderType="NVarChar" Scale="0" Size="50" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="value" DataSetColumn="value" />
<Mapping SourceColumn="label" DataSetColumn="label" />
<Mapping SourceColumn="ordine" DataSetColumn="ordine" />
</Mappings>
<Sources />
</TableAdapter>
</Tables>
<Sources />
</DataSource>
</xs:appinfo>
</xs:annotation>
<xs:element name="DS_Utility" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="DS_Utility" msprop:Generator_UserDSName="DS_Utility">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="v_selDipendenti" msprop:Generator_TableClassName="v_selDipendentiDataTable" msprop:Generator_TableVarName="tablev_selDipendenti" msprop:Generator_RowChangedName="v_selDipendentiRowChanged" msprop:Generator_TablePropName="v_selDipendenti" msprop:Generator_RowDeletingName="v_selDipendentiRowDeleting" msprop:Generator_RowChangingName="v_selDipendentiRowChanging" msprop:Generator_RowEvHandlerName="v_selDipendentiRowChangeEventHandler" msprop:Generator_RowDeletedName="v_selDipendentiRowDeleted" msprop:Generator_RowClassName="v_selDipendentiRow" msprop:Generator_UserTableName="v_selDipendenti" msprop:Generator_RowEvArgName="v_selDipendentiRowChangeEvent">
<xs:complexType>
<xs:sequence>
<xs:element name="value" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value" type="xs:int" />
<xs:element name="label" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="101" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="stp_getLastDays" msprop:Generator_TableClassName="stp_getLastDaysDataTable" msprop:Generator_TableVarName="tablestp_getLastDays" msprop:Generator_TablePropName="stp_getLastDays" msprop:Generator_RowDeletingName="stp_getLastDaysRowDeleting" msprop:Generator_RowChangingName="stp_getLastDaysRowChanging" msprop:Generator_RowEvHandlerName="stp_getLastDaysRowChangeEventHandler" msprop:Generator_RowDeletedName="stp_getLastDaysRowDeleted" msprop:Generator_UserTableName="stp_getLastDays" msprop:Generator_RowChangedName="stp_getLastDaysRowChanged" msprop:Generator_RowEvArgName="stp_getLastDaysRowChangeEvent" msprop:Generator_RowClassName="stp_getLastDaysRow">
<xs:complexType>
<xs:sequence>
<xs:element name="Data" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnData" msprop:Generator_ColumnPropNameInRow="Data" msprop:Generator_ColumnPropNameInTable="DataColumn" msprop:Generator_UserColumnName="Data" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="stp_getMin" msprop:Generator_TableClassName="stp_getMinDataTable" msprop:Generator_TableVarName="tablestp_getMin" msprop:Generator_TablePropName="stp_getMin" msprop:Generator_RowDeletingName="stp_getMinRowDeleting" msprop:Generator_RowChangingName="stp_getMinRowChanging" msprop:Generator_RowEvHandlerName="stp_getMinRowChangeEventHandler" msprop:Generator_RowDeletedName="stp_getMinRowDeleted" msprop:Generator_UserTableName="stp_getMin" msprop:Generator_RowChangedName="stp_getMinRowChanged" msprop:Generator_RowEvArgName="stp_getMinRowChangeEvent" msprop:Generator_RowClassName="stp_getMinRow">
<xs:complexType>
<xs:sequence>
<xs:element name="minuto" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnminuto" msprop:Generator_ColumnPropNameInRow="minuto" msprop:Generator_ColumnPropNameInTable="minutoColumn" msprop:Generator_UserColumnName="minuto" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="stp_getHours" msprop:Generator_TableClassName="stp_getHoursDataTable" msprop:Generator_TableVarName="tablestp_getHours" msprop:Generator_TablePropName="stp_getHours" msprop:Generator_RowDeletingName="stp_getHoursRowDeleting" msprop:Generator_RowChangingName="stp_getHoursRowChanging" msprop:Generator_RowEvHandlerName="stp_getHoursRowChangeEventHandler" msprop:Generator_RowDeletedName="stp_getHoursRowDeleted" msprop:Generator_UserTableName="stp_getHours" msprop:Generator_RowChangedName="stp_getHoursRowChanged" msprop:Generator_RowEvArgName="stp_getHoursRowChangeEvent" msprop:Generator_RowClassName="stp_getHoursRow">
<xs:complexType>
<xs:sequence>
<xs:element name="ora" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnora" msprop:Generator_ColumnPropNameInRow="ora" msprop:Generator_ColumnPropNameInTable="oraColumn" msprop:Generator_UserColumnName="ora" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="v_selProgetti" msprop:Generator_TableClassName="v_selProgettiDataTable" msprop:Generator_TableVarName="tablev_selProgetti" msprop:Generator_RowChangedName="v_selProgettiRowChanged" msprop:Generator_TablePropName="v_selProgetti" msprop:Generator_RowDeletingName="v_selProgettiRowDeleting" msprop:Generator_RowChangingName="v_selProgettiRowChanging" msprop:Generator_RowEvHandlerName="v_selProgettiRowChangeEventHandler" msprop:Generator_RowDeletedName="v_selProgettiRowDeleted" msprop:Generator_RowClassName="v_selProgettiRow" msprop:Generator_UserTableName="v_selProgetti" msprop:Generator_RowEvArgName="v_selProgettiRowChangeEvent">
<xs:complexType>
<xs:sequence>
<xs:element name="value" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value" type="xs:int" />
<xs:element name="label" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="130" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="conditio" msprop:Generator_ColumnVarNameInTable="columnconditio" msprop:Generator_ColumnPropNameInRow="conditio" msprop:Generator_ColumnPropNameInTable="conditioColumn" msprop:Generator_UserColumnName="conditio" type="xs:int" />
<xs:element name="Attivo" msprop:Generator_ColumnVarNameInTable="columnAttivo" msprop:Generator_ColumnPropNameInRow="Attivo" msprop:Generator_ColumnPropNameInTable="AttivoColumn" msprop:Generator_UserColumnName="Attivo" type="xs:boolean" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="v_selFasi" msprop:Generator_TableClassName="v_selFasiDataTable" msprop:Generator_TableVarName="tablev_selFasi" msprop:Generator_RowChangedName="v_selFasiRowChanged" msprop:Generator_TablePropName="v_selFasi" msprop:Generator_RowDeletingName="v_selFasiRowDeleting" msprop:Generator_RowChangingName="v_selFasiRowChanging" msprop:Generator_RowEvHandlerName="v_selFasiRowChangeEventHandler" msprop:Generator_RowDeletedName="v_selFasiRowDeleted" msprop:Generator_RowClassName="v_selFasiRow" msprop:Generator_UserTableName="v_selFasi" msprop:Generator_RowEvArgName="v_selFasiRowChangeEvent">
<xs:complexType>
<xs:sequence>
<xs:element name="value" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value" type="xs:int" />
<xs:element name="label" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="conditio" msprop:Generator_ColumnVarNameInTable="columnconditio" msprop:Generator_ColumnPropNameInRow="conditio" msprop:Generator_ColumnPropNameInTable="conditioColumn" msprop:Generator_UserColumnName="conditio" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="v_selClienti" msprop:Generator_TableClassName="v_selClientiDataTable" msprop:Generator_TableVarName="tablev_selClienti" msprop:Generator_TablePropName="v_selClienti" msprop:Generator_RowDeletingName="v_selClientiRowDeleting" msprop:Generator_RowChangingName="v_selClientiRowChanging" msprop:Generator_RowEvHandlerName="v_selClientiRowChangeEventHandler" msprop:Generator_RowDeletedName="v_selClientiRowDeleted" msprop:Generator_UserTableName="v_selClienti" msprop:Generator_RowChangedName="v_selClientiRowChanged" msprop:Generator_RowEvArgName="v_selClientiRowChangeEvent" msprop:Generator_RowClassName="v_selClientiRow">
<xs:complexType>
<xs:sequence>
<xs:element name="value" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value" type="xs:int" />
<xs:element name="label" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="250" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="stp_statsProj" msprop:Generator_TableClassName="stp_statsProjDataTable" msprop:Generator_TableVarName="tablestp_statsProj" msprop:Generator_RowChangedName="stp_statsProjRowChanged" msprop:Generator_TablePropName="stp_statsProj" msprop:Generator_RowDeletingName="stp_statsProjRowDeleting" msprop:Generator_RowChangingName="stp_statsProjRowChanging" msprop:Generator_RowEvHandlerName="stp_statsProjRowChangeEventHandler" msprop:Generator_RowDeletedName="stp_statsProjRowDeleted" msprop:Generator_RowClassName="stp_statsProjRow" msprop:Generator_UserTableName="stp_statsProj" msprop:Generator_RowEvArgName="stp_statsProjRowChangeEvent">
<xs:complexType>
<xs:sequence>
<xs:element name="oreBudget" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnoreBudget" msprop:Generator_ColumnPropNameInRow="oreBudget" msprop:Generator_ColumnPropNameInTable="oreBudgetColumn" msprop:Generator_UserColumnName="oreBudget" type="xs:decimal" minOccurs="0" />
<xs:element name="oreTot" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnoreTot" msprop:Generator_ColumnPropNameInRow="oreTot" msprop:Generator_ColumnPropNameInTable="oreTotColumn" msprop:Generator_UserColumnName="oreTot" type="xs:decimal" minOccurs="0" />
<xs:element name="oreMese" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnoreMese" msprop:Generator_ColumnPropNameInRow="oreMese" msprop:Generator_ColumnPropNameInTable="oreMeseColumn" msprop:Generator_UserColumnName="oreMese" type="xs:decimal" minOccurs="0" />
<xs:element name="oreMesePrec" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnoreMesePrec" msprop:Generator_ColumnPropNameInRow="oreMesePrec" msprop:Generator_ColumnPropNameInTable="oreMesePrecColumn" msprop:Generator_UserColumnName="oreMesePrec" type="xs:decimal" minOccurs="0" />
<xs:element name="Attivo" msprop:Generator_ColumnVarNameInTable="columnAttivo" msprop:Generator_ColumnPropNameInRow="Attivo" msprop:Generator_ColumnPropNameInTable="AttivoColumn" msprop:Generator_UserColumnName="Attivo" type="xs:boolean" />
<xs:element name="starred" msprop:Generator_ColumnVarNameInTable="columnstarred" msprop:Generator_ColumnPropNameInRow="starred" msprop:Generator_ColumnPropNameInTable="starredColumn" msprop:Generator_UserColumnName="starred" type="xs:boolean" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="v_selCodGiust" msprop:Generator_TableClassName="v_selCodGiustDataTable" msprop:Generator_TableVarName="tablev_selCodGiust" msprop:Generator_TablePropName="v_selCodGiust" msprop:Generator_RowDeletingName="v_selCodGiustRowDeleting" msprop:Generator_RowChangingName="v_selCodGiustRowChanging" msprop:Generator_RowEvHandlerName="v_selCodGiustRowChangeEventHandler" msprop:Generator_RowDeletedName="v_selCodGiustRowDeleted" msprop:Generator_UserTableName="v_selCodGiust" msprop:Generator_RowChangedName="v_selCodGiustRowChanged" msprop:Generator_RowEvArgName="v_selCodGiustRowChangeEvent" msprop:Generator_RowClassName="v_selCodGiustRow">
<xs:complexType>
<xs:sequence>
<xs:element name="value" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="5" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="label" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="nextValContatore" msprop:Generator_TableClassName="nextValContatoreDataTable" msprop:Generator_TableVarName="tablenextValContatore" msprop:Generator_RowChangedName="nextValContatoreRowChanged" msprop:Generator_TablePropName="nextValContatore" msprop:Generator_RowDeletingName="nextValContatoreRowDeleting" msprop:Generator_RowChangingName="nextValContatoreRowChanging" msprop:Generator_RowEvHandlerName="nextValContatoreRowChangeEventHandler" msprop:Generator_RowDeletedName="nextValContatoreRowDeleted" msprop:Generator_RowClassName="nextValContatoreRow" msprop:Generator_UserTableName="nextValContatore" msprop:Generator_RowEvArgName="nextValContatoreRowChangeEvent">
<xs:complexType>
<xs:sequence>
<xs:element name="Column1" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnColumn1" msprop:Generator_ColumnPropNameInRow="Column1" msprop:Generator_ColumnPropNameInTable="Column1Column" msprop:Generator_UserColumnName="Column1" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="v_selFasiOpt" msprop:Generator_TableClassName="v_selFasiOptDataTable" msprop:Generator_TableVarName="tablev_selFasiOpt" msprop:Generator_TablePropName="v_selFasiOpt" msprop:Generator_RowDeletingName="v_selFasiOptRowDeleting" msprop:Generator_RowChangingName="v_selFasiOptRowChanging" msprop:Generator_RowEvHandlerName="v_selFasiOptRowChangeEventHandler" msprop:Generator_RowDeletedName="v_selFasiOptRowDeleted" msprop:Generator_UserTableName="v_selFasiOpt" msprop:Generator_RowChangedName="v_selFasiOptRowChanged" msprop:Generator_RowEvArgName="v_selFasiOptRowChangeEvent" msprop:Generator_RowClassName="v_selFasiOptRow">
<xs:complexType>
<xs:sequence>
<xs:element name="valueGroup" msprop:Generator_ColumnVarNameInTable="columnvalueGroup" msprop:Generator_ColumnPropNameInRow="valueGroup" msprop:Generator_ColumnPropNameInTable="valueGroupColumn" msprop:Generator_UserColumnName="valueGroup" type="xs:int" />
<xs:element name="value" msdata:ReadOnly="true" msdata:AutoIncrement="true" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value" type="xs:int" />
<xs:element name="label" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="250" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="conditio" msprop:Generator_ColumnVarNameInTable="columnconditio" msprop:Generator_ColumnPropNameInRow="conditio" msprop:Generator_ColumnPropNameInTable="conditioColumn" msprop:Generator_UserColumnName="conditio" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="AnagKeyValue" msprop:Generator_TableClassName="AnagKeyValueDataTable" msprop:Generator_TableVarName="tableAnagKeyValue" msprop:Generator_RowChangedName="AnagKeyValueRowChanged" msprop:Generator_TablePropName="AnagKeyValue" msprop:Generator_RowDeletingName="AnagKeyValueRowDeleting" msprop:Generator_RowChangingName="AnagKeyValueRowChanging" msprop:Generator_RowEvHandlerName="AnagKeyValueRowChangeEventHandler" msprop:Generator_RowDeletedName="AnagKeyValueRowDeleted" msprop:Generator_RowClassName="AnagKeyValueRow" msprop:Generator_UserTableName="AnagKeyValue" msprop:Generator_RowEvArgName="AnagKeyValueRowChangeEvent">
<xs:complexType>
<xs:sequence>
<xs:element name="nomeVar" msprop:Generator_ColumnVarNameInTable="columnnomeVar" msprop:Generator_ColumnPropNameInRow="nomeVar" msprop:Generator_ColumnPropNameInTable="nomeVarColumn" msprop:Generator_UserColumnName="nomeVar">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="valInt" msprop:Generator_ColumnVarNameInTable="columnvalInt" msprop:Generator_ColumnPropNameInRow="valInt" msprop:Generator_ColumnPropNameInTable="valIntColumn" msprop:Generator_UserColumnName="valInt" type="xs:int" minOccurs="0" />
<xs:element name="valFloat" msprop:Generator_ColumnVarNameInTable="columnvalFloat" msprop:Generator_ColumnPropNameInRow="valFloat" msprop:Generator_ColumnPropNameInTable="valFloatColumn" msprop:Generator_UserColumnName="valFloat" type="xs:double" minOccurs="0" />
<xs:element name="valString" msprop:Generator_ColumnVarNameInTable="columnvalString" msprop:Generator_ColumnPropNameInRow="valString" msprop:Generator_ColumnPropNameInTable="valStringColumn" msprop:Generator_UserColumnName="valString" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="250" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="descrizione" msprop:Generator_ColumnVarNameInTable="columndescrizione" msprop:Generator_ColumnPropNameInRow="descrizione" msprop:Generator_ColumnPropNameInTable="descrizioneColumn" msprop:Generator_UserColumnName="descrizione" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="250" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="v_selCodOrario" msprop:Generator_TableClassName="v_selCodOrarioDataTable" msprop:Generator_TableVarName="tablev_selCodOrario" msprop:Generator_TablePropName="v_selCodOrario" msprop:Generator_RowDeletingName="v_selCodOrarioRowDeleting" msprop:Generator_RowChangingName="v_selCodOrarioRowChanging" msprop:Generator_RowEvHandlerName="v_selCodOrarioRowChangeEventHandler" msprop:Generator_RowDeletedName="v_selCodOrarioRowDeleted" msprop:Generator_UserTableName="v_selCodOrario" msprop:Generator_RowChangedName="v_selCodOrarioRowChanged" msprop:Generator_RowEvArgName="v_selCodOrarioRowChangeEvent" msprop:Generator_RowClassName="v_selCodOrarioRow">
<xs:complexType>
<xs:sequence>
<xs:element name="value" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="label" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="250" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="v_selPageSize" msprop:Generator_TableClassName="v_selPageSizeDataTable" msprop:Generator_TableVarName="tablev_selPageSize" msprop:Generator_TablePropName="v_selPageSize" msprop:Generator_RowDeletingName="v_selPageSizeRowDeleting" msprop:Generator_RowChangingName="v_selPageSizeRowChanging" msprop:Generator_RowEvHandlerName="v_selPageSizeRowChangeEventHandler" msprop:Generator_RowDeletedName="v_selPageSizeRowDeleted" msprop:Generator_UserTableName="v_selPageSize" msprop:Generator_RowChangedName="v_selPageSizeRowChanged" msprop:Generator_RowEvArgName="v_selPageSizeRowChangeEvent" msprop:Generator_RowClassName="v_selPageSizeRow">
<xs:complexType>
<xs:sequence>
<xs:element name="value" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="label" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ordinal" msprop:Generator_ColumnVarNameInTable="columnordinal" msprop:Generator_ColumnPropNameInRow="ordinal" msprop:Generator_ColumnPropNameInTable="ordinalColumn" msprop:Generator_UserColumnName="ordinal" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="stp_VSProjFasi_search" msprop:Generator_TableClassName="stp_VSProjFasi_searchDataTable" msprop:Generator_TableVarName="tablestp_VSProjFasi_search" msprop:Generator_TablePropName="stp_VSProjFasi_search" msprop:Generator_RowDeletingName="stp_VSProjFasi_searchRowDeleting" msprop:Generator_RowChangingName="stp_VSProjFasi_searchRowChanging" msprop:Generator_RowEvHandlerName="stp_VSProjFasi_searchRowChangeEventHandler" msprop:Generator_RowDeletedName="stp_VSProjFasi_searchRowDeleted" msprop:Generator_UserTableName="stp_VSProjFasi_search" msprop:Generator_RowChangedName="stp_VSProjFasi_searchRowChanged" msprop:Generator_RowEvArgName="stp_VSProjFasi_searchRowChangeEvent" msprop:Generator_RowClassName="stp_VSProjFasi_searchRow">
<xs:complexType>
<xs:sequence>
<xs:element name="idxProgetto" msprop:Generator_ColumnVarNameInTable="columnidxProgetto" msprop:Generator_ColumnPropNameInRow="idxProgetto" msprop:Generator_ColumnPropNameInTable="idxProgettoColumn" msprop:Generator_UserColumnName="idxProgetto" type="xs:int" minOccurs="0" />
<xs:element name="idxFase" msdata:ReadOnly="true" msdata:AutoIncrement="true" msprop:Generator_ColumnVarNameInTable="columnidxFase" msprop:Generator_ColumnPropNameInRow="idxFase" msprop:Generator_ColumnPropNameInTable="idxFaseColumn" msprop:Generator_UserColumnName="idxFase" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="freqProgetti" msprop:Generator_TableClassName="freqProgettiDataTable" msprop:Generator_TableVarName="tablefreqProgetti" msprop:Generator_RowChangedName="freqProgettiRowChanged" msprop:Generator_TablePropName="freqProgetti" msprop:Generator_RowDeletingName="freqProgettiRowDeleting" msprop:Generator_RowChangingName="freqProgettiRowChanging" msprop:Generator_RowEvHandlerName="freqProgettiRowChangeEventHandler" msprop:Generator_RowDeletedName="freqProgettiRowDeleted" msprop:Generator_RowClassName="freqProgettiRow" msprop:Generator_UserTableName="freqProgetti" msprop:Generator_RowEvArgName="freqProgettiRowChangeEvent">
<xs:complexType>
<xs:sequence>
<xs:element name="nomeComm" msprop:Generator_ColumnVarNameInTable="columnnomeComm" msprop:Generator_ColumnPropNameInRow="nomeComm" msprop:Generator_ColumnPropNameInTable="nomeCommColumn" msprop:Generator_UserColumnName="nomeComm" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="250" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="idxFaseComm" msprop:Generator_ColumnVarNameInTable="columnidxFaseComm" msprop:Generator_ColumnPropNameInRow="idxFaseComm" msprop:Generator_ColumnPropNameInTable="idxFaseCommColumn" msprop:Generator_UserColumnName="idxFaseComm" type="xs:int" minOccurs="0" />
<xs:element name="idxFase" msprop:Generator_ColumnVarNameInTable="columnidxFase" msprop:Generator_ColumnPropNameInRow="idxFase" msprop:Generator_ColumnPropNameInTable="idxFaseColumn" msprop:Generator_UserColumnName="idxFase" type="xs:int" minOccurs="0" />
<xs:element name="nomeProj" msprop:Generator_ColumnVarNameInTable="columnnomeProj" msprop:Generator_ColumnPropNameInRow="nomeProj" msprop:Generator_ColumnPropNameInTable="nomeProjColumn" msprop:Generator_UserColumnName="nomeProj" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="250" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="nomeFase" msprop:Generator_ColumnVarNameInTable="columnnomeFase" msprop:Generator_ColumnPropNameInRow="nomeFase" msprop:Generator_ColumnPropNameInTable="nomeFaseColumn" msprop:Generator_UserColumnName="nomeFase" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="250" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="freq" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnfreq" msprop:Generator_ColumnPropNameInRow="freq" msprop:Generator_ColumnPropNameInTable="freqColumn" msprop:Generator_UserColumnName="freq" type="xs:decimal" minOccurs="0" />
<xs:element name="qty" msprop:Generator_ColumnVarNameInTable="columnqty" msprop:Generator_ColumnPropNameInRow="qty" msprop:Generator_ColumnPropNameInTable="qtyColumn" msprop:Generator_UserColumnName="qty" type="xs:decimal" minOccurs="0" />
<xs:element name="tot" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columntot" msprop:Generator_ColumnPropNameInRow="tot" msprop:Generator_ColumnPropNameInTable="totColumn" msprop:Generator_UserColumnName="tot" type="xs:int" minOccurs="0" />
<xs:element name="RowNum" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnRowNum" msprop:Generator_ColumnPropNameInRow="RowNum" msprop:Generator_ColumnPropNameInTable="RowNumColumn" msprop:Generator_UserColumnName="RowNum" type="xs:long" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="v_selProjFasi" msprop:Generator_TableClassName="v_selProjFasiDataTable" msprop:Generator_TableVarName="tablev_selProjFasi" msprop:Generator_RowChangedName="v_selProjFasiRowChanged" msprop:Generator_TablePropName="v_selProjFasi" msprop:Generator_RowDeletingName="v_selProjFasiRowDeleting" msprop:Generator_RowChangingName="v_selProjFasiRowChanging" msprop:Generator_RowEvHandlerName="v_selProjFasiRowChangeEventHandler" msprop:Generator_RowDeletedName="v_selProjFasiRowDeleted" msprop:Generator_RowClassName="v_selProjFasiRow" msprop:Generator_UserTableName="v_selProjFasi" msprop:Generator_RowEvArgName="v_selProjFasiRowChangeEvent">
<xs:complexType>
<xs:sequence>
<xs:element name="value" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnvalue" msprop:Generator_ColumnPropNameInRow="value" msprop:Generator_ColumnPropNameInTable="valueColumn" msprop:Generator_UserColumnName="value" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="101" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="label" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnlabel" msprop:Generator_ColumnPropNameInRow="label" msprop:Generator_ColumnPropNameInTable="labelColumn" msprop:Generator_UserColumnName="label" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="1315" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ordine" msprop:Generator_ColumnVarNameInTable="columnordine" msprop:Generator_ColumnPropNameInRow="ordine" msprop:Generator_ColumnPropNameInTable="ordineColumn" msprop:Generator_UserColumnName="ordine">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="250" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:v_selDipendenti" />
<xs:field xpath="mstns:value" />
</xs:unique>
<xs:unique name="v_selProgetti_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:v_selProgetti" />
<xs:field xpath="mstns:value" />
</xs:unique>
<xs:unique name="v_selFasi_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:v_selFasi" />
<xs:field xpath="mstns:value" />
</xs:unique>
<xs:unique name="v_selClienti_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:v_selClienti" />
<xs:field xpath="mstns:value" />
</xs:unique>
<xs:unique name="v_selCodGiust_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:v_selCodGiust" />
<xs:field xpath="mstns:value" />
</xs:unique>
<xs:unique name="v_selFasiOpt_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:v_selFasiOpt" />
<xs:field xpath="mstns:valueGroup" />
</xs:unique>
<xs:unique name="AnagKeyValue_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:AnagKeyValue" />
<xs:field xpath="mstns:nomeVar" />
</xs:unique>
<xs:unique name="v_selCodOrario_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:v_selCodOrario" />
<xs:field xpath="mstns:value" />
</xs:unique>
<xs:unique name="stp_VSProjFasi_search_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:stp_VSProjFasi_search" />
<xs:field xpath="mstns:idxFase" />
</xs:unique>
</xs:element>
</xs:schema>
+28
View File
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!--<autogenerated>
This code was generated by a tool to store the dataset designer's layout information.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
</autogenerated>-->
<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="-11" ViewPortY="-10" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
<Shapes>
<Shape ID="DesignTable:v_selDipendenti" ZOrder="17" X="242" Y="271" Height="115" Width="236" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
<Shape ID="DesignTable:stp_getLastDays" ZOrder="16" X="953" Y="61" Height="96" Width="238" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="46" />
<Shape ID="DesignTable:stp_getMin" ZOrder="15" X="966" Y="283" Height="96" Width="209" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="46" />
<Shape ID="DesignTable:stp_getHours" ZOrder="14" X="963" Y="174" Height="96" Width="221" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="46" />
<Shape ID="DesignTable:v_selProgetti" ZOrder="9" X="267" Y="456" Height="191" Width="219" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="102" />
<Shape ID="DesignTable:v_selFasi" ZOrder="8" X="755" Y="540" Height="153" Width="237" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="83" />
<Shape ID="DesignTable:v_selClienti" ZOrder="13" X="662" Y="365" Height="115" Width="209" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
<Shape ID="DesignTable:stp_statsProj" ZOrder="12" X="286" Y="733" Height="191" Width="218" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="140" />
<Shape ID="DesignTable:v_selCodGiust" ZOrder="11" X="1021" Y="470" Height="115" Width="225" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
<Shape ID="DesignTable:nextValContatore" ZOrder="10" X="562" Y="99" Height="130" Width="158" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="79" />
<Shape ID="DesignTable:v_selFasiOpt" ZOrder="4" X="836" Y="755" Height="153" Width="255" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="102" />
<Shape ID="DesignTable:AnagKeyValue" ZOrder="7" X="1059" Y="645" Height="191" Width="229" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="121" />
<Shape ID="DesignTable:v_selCodOrario" ZOrder="6" X="86" Y="680" Height="115" Width="158" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
<Shape ID="DesignTable:v_selPageSize" ZOrder="5" X="14" Y="364" Height="134" Width="223" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="83" />
<Shape ID="DesignTable:stp_VSProjFasi_search" ZOrder="3" X="522" Y="727" Height="115" Width="216" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="64" />
<Shape ID="DesignTable:freqProgetti" ZOrder="2" X="59" Y="10" Height="248" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="197" />
<Shape ID="DesignTable:v_selProjFasi" ZOrder="1" X="782" Y="157" Height="168" Width="158" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="78" />
</Shapes>
<Connectors />
</DiagramLayout>
+3535
View File
File diff suppressed because it is too large Load Diff
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--<autogenerated>
This code was generated by a tool.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
</autogenerated>-->
<DataSetUISetting Version="1.00" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TableUISettings />
</DataSetUISetting>
+317
View File
@@ -0,0 +1,317 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="DS_export" targetNamespace="http://tempuri.org/DS_export.xsd" xmlns:mstns="http://tempuri.org/DS_export.xsd" xmlns="http://tempuri.org/DS_export.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:annotation>
<xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
<DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<Connections>
<Connection AppSettingsObjectName="Settings" AppSettingsPropertyName="GPWConnectionString" ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly" Name="GPWConnectionString (Settings)" ParameterPrefix="@" PropertyReference="ApplicationSettings.GPW_data.Properties.Settings.GlobalReference.Default.GPWConnectionString" Provider="System.Data.SqlClient" />
</Connections>
<Tables>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="TimbratureZucchettiTableAdapter" GeneratorDataComponentClassName="TimbratureZucchettiTableAdapter" Name="TimbratureZucchetti" UserDataComponentName="TimbratureZucchettiTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.export.stp_TimbratureZucchetti" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>export.stp_TimbratureZucchetti</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@dataFrom" Precision="23" ProviderType="DateTime" Scale="3" Size="8" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@dataTo" Precision="23" ProviderType="DateTime" Scale="3" Size="8" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@Dipendente" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="char" DbType="AnsiStringFixedLength" Direction="Input" ParameterName="@Timbratrice" Precision="0" ProviderType="Char" Scale="0" Size="2" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="dataOra" DataSetColumn="dataOra" />
<Mapping SourceColumn="idxDipendente" DataSetColumn="idxDipendente" />
<Mapping SourceColumn="entrata" DataSetColumn="entrata" />
<Mapping SourceColumn="Approv" DataSetColumn="Approv" />
<Mapping SourceColumn="Timbratrice" DataSetColumn="Timbratrice" />
<Mapping SourceColumn="Badge" DataSetColumn="Badge" />
<Mapping SourceColumn="Data" DataSetColumn="Data" />
<Mapping SourceColumn="Ora" DataSetColumn="Ora" />
<Mapping SourceColumn="EntrataUscita" DataSetColumn="EntrataUscita" />
<Mapping SourceColumn="campoExport" DataSetColumn="campoExport" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="RegAtt_pivotTableAdapter" GeneratorDataComponentClassName="RegAtt_pivotTableAdapter" Name="RegAtt_pivot" UserDataComponentName="RegAtt_pivotTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.stp_RA_pivot_getByIdxDipData" DbObjectType="StoredProcedure" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="false" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="false" UserGetMethodName="GetData" UserSourceName="Fill">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_RA_pivot_getByIdxDipData</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@idxDipendente" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@dataFrom" Precision="23" ProviderType="DateTime" Scale="3" Size="8" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="datetime" DbType="DateTime" Direction="Input" ParameterName="@dataTo" Precision="23" ProviderType="DateTime" Scale="3" Size="8" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="RagSociale" DataSetColumn="RagSociale" />
<Mapping SourceColumn="nomeProj" DataSetColumn="nomeProj" />
<Mapping SourceColumn="nomeFase" DataSetColumn="nomeFase" />
<Mapping SourceColumn="Cognome" DataSetColumn="CognomeNome" />
<Mapping SourceColumn="inizio" DataSetColumn="inizio" />
<Mapping SourceColumn="fine" DataSetColumn="fine" />
<Mapping SourceColumn="descrizione" DataSetColumn="descrizione" />
<Mapping SourceColumn="oreTot" DataSetColumn="oreTot" />
<Mapping SourceColumn="importo" DataSetColumn="importo" />
<Mapping SourceColumn="CognomeNome" DataSetColumn="CognomeNome" />
</Mappings>
<Sources />
</TableAdapter>
<TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="ElencoReportTableAdapter" GeneratorDataComponentClassName="ElencoReportTableAdapter" Name="ElencoReport" UserDataComponentName="ElencoReportTableAdapter">
<MainSource>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.ElencoReport" DbObjectType="Table" FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both" GenerateShortCommands="true" GeneratorGetMethodName="GetData" GeneratorSourceName="Fill" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="GetData" UserSourceName="Fill">
<DeleteCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>DELETE FROM [dbo].[ElencoReport] WHERE (([IdxRep] = @Original_IdxRep) AND ([Area] = @Original_Area) AND ((@IsNull_nome = 1 AND [nome] IS NULL) OR ([nome] = @Original_nome)) AND ((@IsNull_descrizione = 1 AND [descrizione] IS NULL) OR ([descrizione] = @Original_descrizione)) AND ((@IsNull_cssClass = 1 AND [cssClass] IS NULL) OR ([cssClass] = @Original_cssClass)) AND ((@IsNull_ReportUrl = 1 AND [ReportUrl] IS NULL) OR ([ReportUrl] = @Original_ReportUrl)))</CommandText>
<Parameters>
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Original_IdxRep" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="IdxRep" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_Area" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="Area" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_nome" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="nome" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_nome" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="nome" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_descrizione" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="descrizione" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_descrizione" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="descrizione" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_cssClass" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="cssClass" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_cssClass" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="cssClass" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_ReportUrl" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="ReportUrl" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_ReportUrl" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="ReportUrl" SourceColumnNullMapping="false" SourceVersion="Original" />
</Parameters>
</DbCommand>
</DeleteCommand>
<InsertCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>INSERT INTO [dbo].[ElencoReport] ([Area], [nome], [descrizione], [cssClass], [ReportUrl]) VALUES (@Area, @nome, @descrizione, @cssClass, @ReportUrl);
SELECT IdxRep, Area, nome, descrizione, cssClass, ReportUrl FROM ElencoReport WHERE (IdxRep = SCOPE_IDENTITY())</CommandText>
<Parameters>
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Area" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="Area" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@nome" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="nome" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@descrizione" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="descrizione" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@cssClass" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="cssClass" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@ReportUrl" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="ReportUrl" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</InsertCommand>
<SelectCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>SELECT IdxRep, Area, nome, descrizione, cssClass, ReportUrl FROM dbo.ElencoReport</CommandText>
<Parameters />
</DbCommand>
</SelectCommand>
<UpdateCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>UPDATE [dbo].[ElencoReport] SET [Area] = @Area, [nome] = @nome, [descrizione] = @descrizione, [cssClass] = @cssClass, [ReportUrl] = @ReportUrl WHERE (([IdxRep] = @Original_IdxRep) AND ([Area] = @Original_Area) AND ((@IsNull_nome = 1 AND [nome] IS NULL) OR ([nome] = @Original_nome)) AND ((@IsNull_descrizione = 1 AND [descrizione] IS NULL) OR ([descrizione] = @Original_descrizione)) AND ((@IsNull_cssClass = 1 AND [cssClass] IS NULL) OR ([cssClass] = @Original_cssClass)) AND ((@IsNull_ReportUrl = 1 AND [ReportUrl] IS NULL) OR ([ReportUrl] = @Original_ReportUrl)));
SELECT IdxRep, Area, nome, descrizione, cssClass, ReportUrl FROM ElencoReport WHERE (IdxRep = @IdxRep)</CommandText>
<Parameters>
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Area" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="Area" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@nome" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="nome" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@descrizione" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="descrizione" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@cssClass" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="cssClass" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@ReportUrl" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="ReportUrl" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Original_IdxRep" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="IdxRep" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_Area" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="Area" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_nome" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="nome" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_nome" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="nome" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_descrizione" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="descrizione" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_descrizione" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="descrizione" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_cssClass" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="cssClass" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_cssClass" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="cssClass" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@IsNull_ReportUrl" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="ReportUrl" SourceColumnNullMapping="true" SourceVersion="Original" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Original_ReportUrl" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="ReportUrl" SourceColumnNullMapping="false" SourceVersion="Original" />
<Parameter AllowDbNull="false" AutogeneratedName="IdxRep" ColumnName="IdxRep" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="Input" ParameterName="@IdxRep" Precision="0" ProviderType="Int" Scale="0" Size="4" SourceColumn="IdxRep" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</UpdateCommand>
</DbSource>
</MainSource>
<Mappings>
<Mapping SourceColumn="IdxRep" DataSetColumn="IdxRep" />
<Mapping SourceColumn="Area" DataSetColumn="Area" />
<Mapping SourceColumn="nome" DataSetColumn="nome" />
<Mapping SourceColumn="descrizione" DataSetColumn="descrizione" />
<Mapping SourceColumn="cssClass" DataSetColumn="cssClass" />
<Mapping SourceColumn="ReportUrl" DataSetColumn="ReportUrl" />
</Mappings>
<Sources>
<DbSource ConnectionRef="GPWConnectionString (Settings)" DbObjectName="GPW.dbo.stp_ER_getByArea" DbObjectType="StoredProcedure" GenerateMethods="Get" GenerateShortCommands="true" GeneratorGetMethodName="getByArea" GetMethodModifier="Public" GetMethodName="getByArea" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true" UserGetMethodName="getByArea" UserSourceName="getByArea">
<SelectCommand>
<DbCommand CommandType="StoredProcedure" ModifiedByUser="false">
<CommandText>dbo.stp_ER_getByArea</CommandText>
<Parameters>
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="int" DbType="Int32" Direction="ReturnValue" ParameterName="@RETURN_VALUE" Precision="10" ProviderType="Int" Scale="0" Size="4" SourceColumnNullMapping="false" SourceVersion="Current" />
<Parameter AllowDbNull="true" AutogeneratedName="" DataSourceName="" DataTypeServer="nvarchar" DbType="String" Direction="Input" ParameterName="@Area" Precision="0" ProviderType="NVarChar" Scale="0" Size="10" SourceColumnNullMapping="false" SourceVersion="Current" />
</Parameters>
</DbCommand>
</SelectCommand>
</DbSource>
</Sources>
</TableAdapter>
</Tables>
<Sources />
</DataSource>
</xs:appinfo>
</xs:annotation>
<xs:element name="DS_export" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="DS_export" msprop:Generator_UserDSName="DS_export">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="TimbratureZucchetti" msprop:Generator_TableClassName="TimbratureZucchettiDataTable" msprop:Generator_TableVarName="tableTimbratureZucchetti" msprop:Generator_TablePropName="TimbratureZucchetti" msprop:Generator_RowDeletingName="TimbratureZucchettiRowDeleting" msprop:Generator_RowChangingName="TimbratureZucchettiRowChanging" msprop:Generator_RowEvHandlerName="TimbratureZucchettiRowChangeEventHandler" msprop:Generator_RowDeletedName="TimbratureZucchettiRowDeleted" msprop:Generator_UserTableName="TimbratureZucchetti" msprop:Generator_RowChangedName="TimbratureZucchettiRowChanged" msprop:Generator_RowEvArgName="TimbratureZucchettiRowChangeEvent" msprop:Generator_RowClassName="TimbratureZucchettiRow">
<xs:complexType>
<xs:sequence>
<xs:element name="dataOra" msprop:Generator_ColumnVarNameInTable="columndataOra" msprop:Generator_ColumnPropNameInRow="dataOra" msprop:Generator_ColumnPropNameInTable="dataOraColumn" msprop:Generator_UserColumnName="dataOra" type="xs:dateTime" />
<xs:element name="idxDipendente" msprop:Generator_ColumnVarNameInTable="columnidxDipendente" msprop:Generator_ColumnPropNameInRow="idxDipendente" msprop:Generator_ColumnPropNameInTable="idxDipendenteColumn" msprop:Generator_UserColumnName="idxDipendente" type="xs:int" />
<xs:element name="entrata" msprop:Generator_ColumnVarNameInTable="columnentrata" msprop:Generator_ColumnPropNameInRow="entrata" msprop:Generator_ColumnPropNameInTable="entrataColumn" msprop:Generator_UserColumnName="entrata" type="xs:boolean" minOccurs="0" />
<xs:element name="Approv" msprop:Generator_ColumnVarNameInTable="columnApprov" msprop:Generator_ColumnPropNameInRow="Approv" msprop:Generator_ColumnPropNameInTable="ApprovColumn" msprop:Generator_UserColumnName="Approv" type="xs:boolean" minOccurs="0" />
<xs:element name="Timbratrice" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnTimbratrice" msprop:Generator_ColumnPropNameInRow="Timbratrice" msprop:Generator_ColumnPropNameInTable="TimbratriceColumn" msprop:Generator_UserColumnName="Timbratrice" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="2" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Badge" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnBadge" msprop:Generator_ColumnPropNameInRow="Badge" msprop:Generator_ColumnPropNameInTable="BadgeColumn" msprop:Generator_UserColumnName="Badge" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="6" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Data" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnData" msprop:Generator_ColumnPropNameInRow="Data" msprop:Generator_ColumnPropNameInTable="DataColumn" msprop:Generator_UserColumnName="Data" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="8" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Ora" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnOra" msprop:Generator_ColumnPropNameInRow="Ora" msprop:Generator_ColumnPropNameInTable="OraColumn" msprop:Generator_UserColumnName="Ora" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="8000" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="EntrataUscita" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnEntrataUscita" msprop:Generator_ColumnPropNameInRow="EntrataUscita" msprop:Generator_ColumnPropNameInTable="EntrataUscitaColumn" msprop:Generator_UserColumnName="EntrataUscita" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="2" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="campoExport" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columncampoExport" msprop:Generator_ColumnPropNameInRow="campoExport" msprop:Generator_ColumnPropNameInTable="campoExportColumn" msprop:Generator_UserColumnName="campoExport" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="4000" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="RegAtt_pivot" msprop:Generator_TableClassName="RegAtt_pivotDataTable" msprop:Generator_TableVarName="tableRegAtt_pivot" msprop:Generator_TablePropName="RegAtt_pivot" msprop:Generator_RowDeletingName="RegAtt_pivotRowDeleting" msprop:Generator_RowChangingName="RegAtt_pivotRowChanging" msprop:Generator_RowEvHandlerName="RegAtt_pivotRowChangeEventHandler" msprop:Generator_RowDeletedName="RegAtt_pivotRowDeleted" msprop:Generator_UserTableName="RegAtt_pivot" msprop:Generator_RowChangedName="RegAtt_pivotRowChanged" msprop:Generator_RowEvArgName="RegAtt_pivotRowChangeEvent" msprop:Generator_RowClassName="RegAtt_pivotRow">
<xs:complexType>
<xs:sequence>
<xs:element name="RagSociale" msprop:Generator_ColumnVarNameInTable="columnRagSociale" msprop:Generator_ColumnPropNameInRow="RagSociale" msprop:Generator_ColumnPropNameInTable="RagSocialeColumn" msprop:Generator_UserColumnName="RagSociale" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="nomeProj" msprop:Generator_ColumnVarNameInTable="columnnomeProj" msprop:Generator_ColumnPropNameInRow="nomeProj" msprop:Generator_ColumnPropNameInTable="nomeProjColumn" msprop:Generator_UserColumnName="nomeProj">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="nomeFase" msprop:Generator_ColumnVarNameInTable="columnnomeFase" msprop:Generator_ColumnPropNameInRow="nomeFase" msprop:Generator_ColumnPropNameInTable="nomeFaseColumn" msprop:Generator_UserColumnName="nomeFase" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="250" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CognomeNome" msprop:Generator_ColumnVarNameInTable="columnCognomeNome" msprop:Generator_ColumnPropNameInRow="CognomeNome" msprop:Generator_ColumnPropNameInTable="CognomeNomeColumn" msprop:Generator_UserColumnName="CognomeNome" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="250" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="inizio" msprop:Generator_ColumnVarNameInTable="columninizio" msprop:Generator_ColumnPropNameInRow="inizio" msprop:Generator_ColumnPropNameInTable="inizioColumn" msprop:Generator_UserColumnName="inizio" type="xs:dateTime" />
<xs:element name="fine" msprop:Generator_ColumnVarNameInTable="columnfine" msprop:Generator_ColumnPropNameInRow="fine" msprop:Generator_ColumnPropNameInTable="fineColumn" msprop:Generator_UserColumnName="fine" type="xs:dateTime" />
<xs:element name="descrizione" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columndescrizione" msprop:Generator_ColumnPropNameInRow="descrizione" msprop:Generator_ColumnPropNameInTable="descrizioneColumn" msprop:Generator_UserColumnName="descrizione" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="500" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="oreTot" msdata:ReadOnly="true" msprop:Generator_ColumnVarNameInTable="columnoreTot" msprop:Generator_ColumnPropNameInRow="oreTot" msprop:Generator_ColumnPropNameInTable="oreTotColumn" msprop:Generator_UserColumnName="oreTot" type="xs:decimal" minOccurs="0" />
<xs:element name="importo" msprop:Generator_ColumnVarNameInTable="columnimporto" msprop:Generator_ColumnPropNameInRow="importo" msprop:Generator_ColumnPropNameInTable="importoColumn" msprop:Generator_UserColumnName="importo" type="xs:decimal" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ElencoReport" msprop:Generator_TableClassName="ElencoReportDataTable" msprop:Generator_TableVarName="tableElencoReport" msprop:Generator_TablePropName="ElencoReport" msprop:Generator_RowDeletingName="ElencoReportRowDeleting" msprop:Generator_RowChangingName="ElencoReportRowChanging" msprop:Generator_RowEvHandlerName="ElencoReportRowChangeEventHandler" msprop:Generator_RowDeletedName="ElencoReportRowDeleted" msprop:Generator_UserTableName="ElencoReport" msprop:Generator_RowChangedName="ElencoReportRowChanged" msprop:Generator_RowEvArgName="ElencoReportRowChangeEvent" msprop:Generator_RowClassName="ElencoReportRow">
<xs:complexType>
<xs:sequence>
<xs:element name="IdxRep" msdata:ReadOnly="true" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1" msprop:Generator_ColumnVarNameInTable="columnIdxRep" msprop:Generator_ColumnPropNameInRow="IdxRep" msprop:Generator_ColumnPropNameInTable="IdxRepColumn" msprop:Generator_UserColumnName="IdxRep" type="xs:int" />
<xs:element name="Area" msprop:Generator_ColumnVarNameInTable="columnArea" msprop:Generator_ColumnPropNameInRow="Area" msprop:Generator_ColumnPropNameInTable="AreaColumn" msprop:Generator_UserColumnName="Area">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="nome" msprop:Generator_ColumnVarNameInTable="columnnome" msprop:Generator_ColumnPropNameInRow="nome" msprop:Generator_ColumnPropNameInTable="nomeColumn" msprop:Generator_UserColumnName="nome" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="descrizione" msprop:Generator_ColumnVarNameInTable="columndescrizione" msprop:Generator_ColumnPropNameInRow="descrizione" msprop:Generator_ColumnPropNameInTable="descrizioneColumn" msprop:Generator_UserColumnName="descrizione" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="250" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="cssClass" msprop:Generator_ColumnVarNameInTable="columncssClass" msprop:Generator_ColumnPropNameInRow="cssClass" msprop:Generator_ColumnPropNameInTable="cssClassColumn" msprop:Generator_UserColumnName="cssClass" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="250" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="ReportUrl" msprop:Generator_ColumnVarNameInTable="columnReportUrl" msprop:Generator_ColumnPropNameInRow="ReportUrl" msprop:Generator_ColumnPropNameInTable="ReportUrlColumn" msprop:Generator_UserColumnName="ReportUrl" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="500" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:TimbratureZucchetti" />
<xs:field xpath="mstns:dataOra" />
<xs:field xpath="mstns:idxDipendente" />
</xs:unique>
<xs:unique name="ElencoReport_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:ElencoReport" />
<xs:field xpath="mstns:IdxRep" />
</xs:unique>
</xs:element>
</xs:schema>
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!--<autogenerated>
This code was generated by a tool to store the dataset designer's layout information.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
</autogenerated>-->
<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="-10" ViewPortY="-10" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
<Shapes>
<Shape ID="DesignTable:TimbratureZucchetti" ZOrder="3" X="87" Y="143" Height="248" Width="389" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="197" />
<Shape ID="DesignTable:RegAtt_pivot" ZOrder="2" X="519" Y="212" Height="248" Width="300" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="197" />
<Shape ID="DesignTable:ElencoReport" ZOrder="1" X="669" Y="621" Height="210" Width="222" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="140" />
</Shapes>
<Connectors />
</DiagramLayout>
+253
View File
@@ -0,0 +1,253 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SteamWare;
namespace GPW_data
{
/// <summary>
/// proxy accesso ai dati
/// </summary>
public class DataProxy
{
#region area table adapters
public DS_ApplicazioneTableAdapters.AnagClientiTableAdapter taAnCli;
public DS_ApplicazioneTableAdapters.TimbratureTableAdapter taTimb;
public DS_ApplicazioneTableAdapters.TimbratureExplTableAdapter taTimbExpl;
public DS_ApplicazioneTableAdapters.AnagDevicesTableAdapter taAnagDev;
public DS_ApplicazioneTableAdapters.DipendentiTableAdapter taDipendenti;
public DS_ApplicazioneTableAdapters.Dipendenti2RuoliTableAdapter taDip2Ruoli;
public DS_ApplicazioneTableAdapters.AnagProgettiTableAdapter taAP;
public DS_ApplicazioneTableAdapters.AnagFasiTableAdapter taAF;
public DS_ApplicazioneTableAdapters.v_logCommUtTableAdapter taLCU;
public DS_ApplicazioneTableAdapters.RegAttivitaTableAdapter taRA;
public DS_ApplicazioneTableAdapters.regAttDayExplTableAdapter taRAExpl;
public DS_ApplicazioneTableAdapters.AnagOrariTableAdapter taAO;
public DS_ApplicazioneTableAdapters.GiustificativiTableAdapter taGiust;
public DS_ApplicazioneTableAdapters.stp_DipendentiAndAnomalieTableAdapter taDipAnom;
public DS_ApplicazioneTableAdapters.TE_RA_ExplTableAdapter taTimbRegAtt;
public DS_ApplicazioneTableAdapters.RegistroEventiTableAdapter taRE;
public DS_UtilityTableAdapters.nextValContatoreTableAdapter taNextVal;
public DS_UtilityTableAdapters.AnagKeyValueTableAdapter taAKV;
public DS_UtilityTableAdapters.stp_VSProjFasi_searchTableAdapter taVSProjFasiSearch;
public DS_UtilityTableAdapters.v_selProjFasiTableAdapter taVSPF;
public DS_exportTableAdapters.TimbratureZucchettiTableAdapter taExpZucc;
public DS_exportTableAdapters.RegAtt_pivotTableAdapter taExpComm;
/// <summary>
/// init dei table adapters
/// </summary>
protected void initTA()
{
taAnCli = new DS_ApplicazioneTableAdapters.AnagClientiTableAdapter();
taTimb = new DS_ApplicazioneTableAdapters.TimbratureTableAdapter();
taTimbExpl = new DS_ApplicazioneTableAdapters.TimbratureExplTableAdapter();
taAnagDev = new DS_ApplicazioneTableAdapters.AnagDevicesTableAdapter();
taDipendenti = new DS_ApplicazioneTableAdapters.DipendentiTableAdapter();
taDip2Ruoli = new DS_ApplicazioneTableAdapters.Dipendenti2RuoliTableAdapter();
taAP = new DS_ApplicazioneTableAdapters.AnagProgettiTableAdapter();
taAF = new DS_ApplicazioneTableAdapters.AnagFasiTableAdapter();
taLCU = new DS_ApplicazioneTableAdapters.v_logCommUtTableAdapter();
taRA = new DS_ApplicazioneTableAdapters.RegAttivitaTableAdapter();
taRAExpl = new DS_ApplicazioneTableAdapters.regAttDayExplTableAdapter();
taAO = new DS_ApplicazioneTableAdapters.AnagOrariTableAdapter();
taGiust = new DS_ApplicazioneTableAdapters.GiustificativiTableAdapter();
taDipAnom = new DS_ApplicazioneTableAdapters.stp_DipendentiAndAnomalieTableAdapter();
taTimbRegAtt = new DS_ApplicazioneTableAdapters.TE_RA_ExplTableAdapter();
taRE = new DS_ApplicazioneTableAdapters.RegistroEventiTableAdapter();
taNextVal = new DS_UtilityTableAdapters.nextValContatoreTableAdapter();
taAKV = new DS_UtilityTableAdapters.AnagKeyValueTableAdapter();
taVSProjFasiSearch = new DS_UtilityTableAdapters.stp_VSProjFasi_searchTableAdapter();
taVSPF = new DS_UtilityTableAdapters.v_selProjFasiTableAdapter();
taExpZucc = new DS_exportTableAdapters.TimbratureZucchettiTableAdapter();
taExpComm = new DS_exportTableAdapters.RegAtt_pivotTableAdapter();
}
/// <summary>
/// effettua setup dei connection strings da web.config delal singola applicazione
/// </summary>
protected virtual void setupConnectionStringBase()
{
// connections del db
taAnCli.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taTimb.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taTimbExpl.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taAnagDev.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taDipendenti.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taDip2Ruoli.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taAP.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taAF.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taLCU.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taRA.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taRAExpl.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taAO.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taGiust.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taDipAnom.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taTimbRegAtt.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taRE.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taNextVal.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taAKV.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taVSProjFasiSearch.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taVSPF.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taExpZucc.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
taExpComm.Connection.ConnectionString = memLayer.ML.confReadString("GPWConnectionString");
}
#endregion
protected DataProxy()
{
initTA();
setupConnectionStringBase();
}
/// <summary>
/// Singleton accesso a DataProxy
/// </summary>
public static DataProxy DP = new DataProxy();
#region utility public esposte
/// <summary>
/// invia una mail al destinatario x linkare nuovi devices tramite URL
/// </summary>
/// <param name="destinatario"></param>
/// <param name="UserAuthKey"></param>
/// <param name="idxDipendente"></param>
/// <returns></returns>
public bool sendUserAuthEmail(string destinatario, string UserAuthKey, int idxDipendente)
{
bool fatto = false;
string smtpCli = "";
string mittente = "";
string oggetto = "";
string userUrl = "";
string baseUrl = "";
string userWebUrl = "";
string baseWebUrl = "";
string corpo = "";
try
{
// compongo la stringa
smtpCli = memLayer.ML.confReadString("_smtpCli");
mittente = memLayer.ML.confReadString("_fromEmail");
oggetto = "Link autorizzazione device per GPW";
baseUrl = memLayer.ML.confReadString("baseUrl");
baseWebUrl = memLayer.ML.confReadString("baseWebUrl");
userUrl = string.Format("{2}jumper.aspx?UserAuthkey={0}&idxDipendente={1}", UserAuthKey, idxDipendente, baseUrl);
userWebUrl = string.Format("{2}jumper.aspx?UserAuthkey={0}&idxDipendente={1}", UserAuthKey, idxDipendente, baseWebUrl);
corpo = string.Format("Hai ricevuto questa email su richiesta tua o dell'Admin per poter procedere a registrare un (nuovo) devices con GPW:{0}<br/>Per proseguire clicca sul link seguente(rete interna):<br />{0}{0}{1}{0}{0}<br /><br />oppure sul link seguente (internet):<br />{0}{0}{2}{0}{0}<br /><br />Team GPW Steamware", Environment.NewLine, userUrl, userWebUrl);
gestEmail.ge.mandaEmail(mittente, destinatario, oggetto, corpo);
fatto = true;
}
catch
{ }
return fatto;
}
/// <summary>
/// effettua enroll del device
/// </summary>
/// <param name="UserAuthKey"></param>
/// <param name="IPv4"></param>
/// <param name="DeviceName"></param>
/// <param name="Description"></param>
/// <param name="idxDipendente"></param>
/// <returns></returns>
public bool enrollDevice(string UserAuthKey, string IPv4, string DeviceName, string Description, int idxDipendente)
{
bool fatto = false;
// in primis testo se dipendente ed authKey sono validi..
if (DataProxy.DP.taDipendenti.getByAuthKey(idxDipendente, UserAuthKey).Rows.Count > 0)
{
/************************************************
* Gestione riconoscimento devices
*
* - cerco IP del device, testo se è rete interna (A) o extranet/internet (B) cercando substring "localNet" da web.config
* (A): device interni: c'è un DHCP, e "dhcpLeaseTime" deve essere pari a lease time---
* - verifico se IP già in uso da un tempo < "dhcpLeaseTime" --> in questo caso segnalo errore e rimbalzo (NON permetto di registrare device a nuovo utente... sospetto uso "improprio" del device
* - se tempo > dhcpLeaseTime allora può aver cambiato IP: aggiorno IP e descrizione del device e proseguo
* (B): all'esterno vedo tutta una subnet NATtata con unico IP, non è + discriminante
* - le timbrature "da esterno" devono essere confermate (instrodurre "tipo timbratura" x cui interne sono autoconfermate, esterne sono "grayed" (da confermare, da admin o ad esempio se si accende secondo device utente entro 5/10 min)
* - le timbrature ext DOVREBBERO chiedere location (jScript?) e inviarla, visibile in conferma
*
*
* **********************************************/
//!!!RIFARE!!! non è + importante device name e description come distinti ma "quasi distinti" gli IP "intranet" o meglio anche ripetuto se a distanza di tempo
#if false
// controllo se esiste già device con quel secret code...
if (DataProxy.DP.taAnagDev.getByDeviceName(DeviceName).Rows.Count > 0)
{
// controllo se è inutilizzato da almeno XX minuti (da web.config), min 5 direi...
bool ip_decaduto = true; // fare cerco IP nei device name e cerco data ultimo utilizzo...
if (ip_decaduto)
{
// in questo caso elimino il record...
DataProxy.DP.taAnagDev.delByDeviceName(DeviceName);
}
else
{
}
}
#endif
// calcolo il secret...
DateTime adesso = DateTime.Now;
string Secret = string.Format("{0}|{1}|{2}", idxDipendente, DeviceName, adesso);
string devSecret = SteamCrypto.EncryptString(Secret, "AuthGPW");
try
{
DataProxy.DP.taAnagDev.insertQuery(devSecret, idxDipendente, DeviceName, Description, adesso, IPv4);
// registro "consumo" della authKey
DataProxy.DP.taDipendenti.recordAuthKeyUse(idxDipendente);
// salvo il cookie nel browser
memLayer.ML.setCookieVal("AuthGPW", devSecret, DateTime.Now.AddYears(5));
// indico come fatto
fatto = true;
}
catch
{ }
}
return fatto;
}
/// <summary>
/// idxDipendente in sessione
/// </summary>
public static int idxDipendente
{
get
{
int idx = 0;
try
{
idx = memLayer.ML.IntSessionObj("IdxDipendente");
}
catch
{ }
return idx;
}
set
{
memLayer.ML.setSessionVal("idxDipendente", value);
}
}
public string CognomeNomeByIdx(int idxDip)
{
string answ = "";
try
{
DS_Applicazione.DipendentiRow rigaDip = taDipendenti.getByIdx(idxDip)[0];
answ = string.Format("{0} {1}", rigaDip.Cognome, rigaDip.Nome);
}
catch
{ }
return answ;
}
#endregion
}
}
Binary file not shown.
+72
View File
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<configSections>
<sectionGroup name="microsoft.web" type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup">
<section name="converters" type="Microsoft.Web.Configuration.ConvertersSection"/>
</sectionGroup>
<section name="microsoft.web.services2" type="Microsoft.Web.Services2.Configuration.WebServicesConfiguration, Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</configSections>
<appSettings>
<webServices>
<soapExtensionTypes>
<add type="Microsoft.Web.Services2.WebServicesExtension, Microsoft.Web.Services2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" priority="1" group="0"/>
</soapExtensionTypes>
</webServices>
<add key="_logDir" value="./logs/"/>
<add key="_smtpCli" value="10.10.11.22"/>
</appSettings>
<microsoft.web>
<converters>
<add type="Microsoft.Web.Script.Serialization.Converters.DataSetConverter"/>
<add type="Microsoft.Web.Script.Serialization.Converters.DataRowConverter"/>
<add type="Microsoft.Web.Script.Serialization.Converters.DataTableConverter"/>
</converters>
</microsoft.web>
<!-- SteamWare -->
<connectionStrings>
<add name="SteamWare.Properties.Settings.loggerConnectionString"
connectionString="Data Source=SQL-STEAM\SQL2012;Initial Catalog=Flamma_SC;Persist Security Info=True;User ID=sa;Password=keyhammer"
providerName="System.Data.SqlClient" />
<add name="SteamWare.Properties.Settings.SteamWare_VocabolarioConnectionString"
connectionString="Data Source=SQL-STEAM\SQL2012;Initial Catalog=SteamWare_Vocabolario;Persist Security Info=True;User ID=sa;Password=keyhammer"
providerName="System.Data.SqlClient" />
<add name="SteamWare.Properties.Settings.DS_AuthConnectionString"
connectionString="Data Source=SQL-STEAM\SQL2012;Initial Catalog=SteamWare_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer"
providerName="System.Data.SqlClient" />
<add name="SteamWare.Properties.Settings.AnagraficaBremboConnectionString"
connectionString="Data Source=SQL-STEAM\SQL2012;Initial Catalog=AnagraficaBrembo;Persist Security Info=True;User ID=sa;Password=keyhammer"
providerName="System.Data.SqlClient" />
<add name="SteamWare.Properties.Settings.SteamWare_BremboConnectionString"
connectionString="Data Source=SQL-STEAM\SQL2012;Initial Catalog=SteamWare_Brembo;Persist Security Info=True;User ID=sa;Password=keyhammer"
providerName="System.Data.SqlClient" />
<add name="SteamWare.Properties.Settings.Flamma_AnagraficaConnectionString"
connectionString="Data Source=SQL-STEAM\SQL2012;Initial Catalog=Flamma_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer"
providerName="System.Data.SqlClient" />
<add name="SteamWare.Properties.Settings.ETS_AnagraficaConnectionString"
connectionString="Data Source=SQL-STEAM\SQL2012;Initial Catalog=SteamWare_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer"
providerName="System.Data.SqlClient" />
<add name="SteamWare.Properties.Settings.ETS_AnagraficaConnectionString1"
connectionString="Data Source=SQL-STEAM\SQL2012;Initial Catalog=SteamWare_Anagrafica;Persist Security Info=True;User ID=sa;Password=keyhammer"
providerName="System.Data.SqlClient" />
<add name="SteamWare.Properties.Settings.SEL_fatture_SteamWareConnectionString"
connectionString="Data Source=SQL-STEAM\SQL2012;Initial Catalog=SEL_fatture_SteamWare;User ID=sa;Password=keyhammer;Encrypt=False;TrustServerCertificate=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<pages>
<controls>
<add namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
<add namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
</controls>
</pages>
<!-- ASMX is mapped to a new handler so that proxy javascripts can also be served. -->
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="Microsoft.Web.Services.ScriptModule"/>
</httpModules>
</system.web>
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>
+48
View File
@@ -0,0 +1,48 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GPW_data.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=10.74.82.217\\SQL2008R2;Initial Catalog=GPW;Persist Security Info=True" +
";User ID=sa;Password=keyhammer")]
public string GPWConnectionString {
get {
return ((string)(this["GPWConnectionString"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=10.74.82.217\\SQL2008R2;Initial Catalog=ETS_GPW;Persist Security Info=" +
"True;User ID=sa;Password=keyhammer")]
public string ETS_GPWConnectionString {
get {
return ((string)(this["ETS_GPWConnectionString"]));
}
}
}
}
+22
View File
@@ -0,0 +1,22 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="GPW_data.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="GPWConnectionString" Type="(Connection string)" Scope="Application">
<DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;ConnectionString&gt;Data Source=10.74.82.217\SQL2008R2;Initial Catalog=GPW;Persist Security Info=True;User ID=sa;Password=keyhammer&lt;/ConnectionString&gt;
&lt;ProviderName&gt;System.Data.SqlClient&lt;/ProviderName&gt;
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Data Source=10.74.82.217\SQL2008R2;Initial Catalog=GPW;Persist Security Info=True;User ID=sa;Password=keyhammer</Value>
</Setting>
<Setting Name="ETS_GPWConnectionString" Type="(Connection string)" Scope="Application">
<DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;ConnectionString&gt;Data Source=10.74.82.217\SQL2008R2;Initial Catalog=ETS_GPW;Persist Security Info=True;User ID=sa;Password=keyhammer&lt;/ConnectionString&gt;
&lt;ProviderName&gt;System.Data.SqlClient&lt;/ProviderName&gt;
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Data Source=10.74.82.217\SQL2008R2;Initial Catalog=ETS_GPW;Persist Security Info=True;User ID=sa;Password=keyhammer</Value>
</Setting>
</Settings>
</SettingsFile>
@@ -0,0 +1,68 @@
SELECT *
FROM TMP_importFasi tf
INNER JOIN ETS_ScipHalf.dbo.commesse c ON dbo.f_padLeft(tf.NumComm, 4,'0')=c.NrComme AND dbo.f_padLeft(tf.anno, 4,'0')=c.Anno
select * from AnagClienti
select * from AnagProgetti
select * from AnagFasi
SELECT * FROM ETS_ScipHalf.dbo.commesse
-- step 0: creo clienti!
SELECT DISTINCT Commitente INTO TMP_RawClienti
FROM ETS_ScipHalf.dbo.commesse
INSERT INTO AnagClienti(RagSociale)
SELECT Commitente from TMP_RawClienti
-- step 1: creo progetti (tutti) INATTIVI
INSERT INTO AnagProgetti(idxCliente, nomeProj, descrProj, attivo, codExt, avvio, chiusura)
SELECT ac.idxCliente, NrComme+'-'+Anno as nomeProj, Descrizione as descrProj, 0, NrProtocollo as codExt, dataApe as avvio, DataSca as chiusura
FROM ETS_ScipHalf.dbo.commesse c
INNER JOIN AnagClienti ac ON c.Commitente=ac.RagSociale
-- step 2: indico attivi solo i progetti che ho trovato da tam import
UPDATE ap
SET Attivo = 1
FROM AnagProgetti ap INNER JOIN TMP_importFasi tif ON ap.nomeProj = dbo.f_padLeft(tif.NumComm, 4,'0') +'-'+dbo.f_padLeft(tif.anno, 4,'0')
-- step 3: creo fasi MACRO (ancestor) da TUTTI i progetti ATTIVI
INSERT INTO AnagFasi( idxProgetto, codFase, idxFaseAncest, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo, budgetTime, budgetMoney)
SELECT idxProgetto, '' as codFase, 0 as idxFaseAncest, nomeProj, descrProj, 0 as enabTime, 0 as enabMon, Attivo, 0 as bdgTim, 0 as bdgMon
FROM AnagProgetti ap
WHERE attivo = 1
-- step 4: creo vere (sotto) fasi
INSERT INTO AnagFasi( idxProgetto, codFase, idxFaseAncest, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo, budgetTime, budgetMoney)
SELECT af.idxProgetto, '' as codFase, af.idxFase AS idxFaseAncest, tif.NomeFase, tif.NomeFase, 1 as enabTime, 0 as enabMon, 1, 0 as bdgTim, 0 as bdgMon
FROM AnagFasi af
INNER JOIN TMP_importFasi tif ON af.nomeFase = dbo.f_padLeft(tif.NumComm, 4,'0') +'-'+dbo.f_padLeft(tif.anno, 4,'0')
-- step 5: sistemo progetti con date apertura/chiusura nulle e oldIdx nulli...
UPDATE AnagProgetti
SET avvio = '1900-01-01'
where avvio IS NULL
UPDATE AnagProgetti
SET chiusura = '2100-12-31'
where chiusura IS NULL
UPDATE AnagProgetti
SET OldIdx =-1
WHERE OldIdx is null
--- update finale
-- inserisco commesse mancanti
INSERT INTO AnagFasi( idxProgetto, codFase, idxFaseAncest, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo, budgetTime, budgetMoney)
SELECT idxProgetto, '' as codFase, 0 as idxFaseAncest, nomeProj, descrProj, 0 as enabTime, 0 as enabMon, Attivo, 0 as bdgTim, 0 as bdgMon
FROM AnagProgetti ap
WHERE attivo = 0
-- inserisco sottofasi (fasi) mancanti a "generale"
INSERT INTO AnagFasi( idxProgetto, codFase, idxFaseAncest, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo, budgetTime, budgetMoney)
SELECT af.idxProgetto, '' as codFase, af.idxFase AS idxFaseAncest, 'GENERALE', 'GENERALE', 1 as enabTime, 0 as enabMon, 0, 0 as bdgTim, 0 as bdgMon
FROM AnagFasi af
WHERE af.idxFase > 493
+208
View File
@@ -0,0 +1,208 @@
alter table Giustificativi add
constraint DF_Giustificativi_automatico default (0) for automatico
go
set xact_abort on
go
begin transaction
go
set ANSI_NULLS on
go
/*----------------------------------
* stp_ricalcolaPeriodoLav
*
* Aggiorna la tab dei periodi lavorati ricalcolando la giornata del record interessato
*
* creato da: S.E.L. - 2008.06.09
* ultima modifica: S.E.L. - 2012.02.06
*----------------------------------*/
alter PROCEDURE stp_ricalcolaPeriodoLav
(
@idxDipendente AS INT,
@dataRif AS DATETIME
)
AS
DECLARE @round AS INT
SET @round = ( SELECT valInt FROM AnagKeyValue WHERE nomeVar = 'minutiRound' )
-- creo la tabella temporanea con riga incrementale
DECLARE @entrate TABLE
(
idxDipendente INT NULL,
oraTimbrata DATETIME NULL,
RowNum INT NOT NULL
)
DECLARE @uscite TABLE
(
idxDipendente INT NULL,
oraTimbrata DATETIME NULL,
RowNum INT NOT NULL
)
-- elimino i periodi della data indicata...
DELETE FROM PeriodiLav
WHERE (idxDipendente = @idxDipendente) AND (CONVERT(varchar(8), entrata, 112) = CONVERT(varchar(8), @dataRif, 112))
-- ENTRATE!!!
INSERT INTO @entrate
SELECT idxDipendente,
DATEADD(n, (ROUND(dbo.TimeSpanUnits('m', dbo.TimeOnly(dateadd(n,-1,dataOra))) / @round, 2) + 1) * @round , dbo.DateOnly(dataOra)) AS oraTimbrata
,ROW_NUMBER() OVER(ORDER BY dataOra) AS 'RowNum'
FROM Timbrature
WHERE (idxDipendente = @idxDipendente)
AND dbo.DateOnly(dataOra) = dbo.DateOnly(@dataRif)
AND (entrata = 1)
-- USCITE!!!
INSERT INTO @uscite
SELECT idxDipendente
, DATEADD(n, (ROUND(dbo.TimeSpanUnits('m', dbo.TimeOnly(dateadd(n,-1,dataOra))) / @round, 2) + 1) * @round , dbo.DateOnly(dataOra)) AS oraTimbrata
, ROW_NUMBER() OVER(ORDER BY dataOra) AS 'RowNum'
FROM Timbrature
WHERE (idxDipendente = @idxDipendente) AND dbo.DateOnly(dataOra) = dbo.DateOnly(@dataRif) AND (entrata = 0)
INSERT INTO PeriodiLav(idxDipendente, entrata, uscita, rowNum)
SELECT cte_in.idxDipendente, cte_in.oraTimbrata, cte_out.oraTimbrata, cte_in.RowNum
FROM @entrate AS cte_in LEFT OUTER JOIN @uscite AS cte_out ON cte_in.idxDipendente=cte_out.idxDipendente AND cte_in.RowNum=cte_out.RowNum
-- inserisco eventuali singole timbrature uscita come in/out uguali
INSERT INTO PeriodiLav(idxDipendente, entrata, uscita, rowNum)
SELECT cte_out.idxDipendente, cte_out.oraTimbrata, cte_out.oraTimbrata, cte_out.RowNum
FROM @entrate AS cte_in RIGHT OUTER JOIN @uscite AS cte_out ON cte_in.idxDipendente=cte_out.idxDipendente AND cte_in.RowNum=cte_out.RowNum
WHERE cte_in.RowNum IS NULL
RETURN
go
/*----------------------------------
* stp_timbratureExpl_ByUserDate
*
* Recupera la tab delletimbrature expl x utente e intervallo date
* mod: S.E.L. - 2012.09.17
*----------------------------------*/
alter PROCEDURE stp_timbratureExpl_ByUserDate
(
@idxDipendente INT,
@dataFrom DATETIME,
@dataTo DATETIME,
@showWE BIT = 1 -- imposto visualizzazione week-end a true di default
)
AS
-- imposto LUN x inizio settimana
SET DATEFIRST 1
SELECT *
FROM TimbratureExpl
WHERE (idxDipendente = @idxDipendente OR @idxDipendente = 0)
AND dataLav >= @dataFrom AND dataLav < @dataTo
AND DATEPART(dw, dataLav) <= CASE WHEN @showWE=0 THEN 5 ELSE 7 END --solo lun-ven, 1-5
ORDER BY dataLav DESC
RETURN
go
commit
go
set xact_abort on
go
begin transaction
go
set ANSI_NULLS on
go
/*----------------------------------
* stp_ricalcolaTimbExpl_byPeriodoUser
*
* Ricalcola le TimbratureExpl x utente e intervallo date
* mod: S.E.L. - 2012.09.17
*----------------------------------*/
create PROCEDURE stp_ricalcolaTimbExpl_byPeriodoUser
(
@idxDipendente INT = 0,
@inizio DATETIME,
@fine DATETIME
)
AS
SET DATEFIRST 1
-- quanti giorni mi servono? conto giorni del mese
DECLARE @numD INT
SET @numD = ( SELECT DATEDIFF(dd, @inizio, @fine) )
-- contatore per ciclo
DECLARE @currRow INT = 0
DECLARE @currIdxDip INT = 0
DECLARE @currDate DATETIME
-- creo la tabella temporanea con riga incrementale
DECLARE @dateAndUser TABLE
(
Riga int IDENTITY(1,1) NOT NULL,
DATA DATETIME NULL,
idxDipendente INT NULL
)
-- elenco delle date DEL MESE (compresi sab/dom) fino a max data odierna
;WITH myCTE AS
(
SELECT dbo.DateOnly(DATEADD(dd, (N-1), @inizio)) as Data, idxDipendente
FROM Tally, Dipendenti
WHERE N <= @numD
AND (idxDipendente = @idxDipendente OR @idxDipendente = 0)
)
-- inserisco valori cte in temp table!
INSERT INTO @dateAndUser
SELECT * FROM myCTE
-- eseguo update! Iterazione sulle righe della CTE
WHILE 1 = 1
BEGIN
-- Get next customerId
SELECT TOP 1 @currRow=Riga, @currIdxDip=idxDipendente, @currDate=Data
FROM @dateAndUser
WHERE Riga > @currRow
ORDER BY Riga
-- Exit loop if no more customers
IF @@ROWCOUNT = 0 BREAK;
-- ESEGUO!
--select @currIdxDip, @currDate
EXEC stp_ricalcolaTimbratureExpl @currIdxDip, @currDate
END
RETURN
go
commit
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(200, GETDATE())
GO
+79
View File
@@ -0,0 +1,79 @@
set xact_abort on
go
begin transaction
go
set ANSI_NULLS on
go
------------------------------------------------------------------------
-- stp_DipendentiAndAnomalie
--
-- Elenco dipendenti con email, data, tipo anomalia... (con AND!!!)
-- mod: S.E.L. - 2013.01.10
------------------------------------------------------------------------
create PROCEDURE stp_DipendentiAndAnomalie
(
@inizio DATETIME,
@fine DATETIME,
@notOkApp BIT = 0, -- 0 = tutte, 1 solo con anomalia
@notOkTim BIT = 0, -- 0 = tutte, 1 solo con anomalia
@notOkLav BIT = 0 -- 0 = tutte, 1 solo con anomalia
)
AS
SELECT DISTINCT d.idxDipendente, te.CognomeNome, d.email
FROM TimbratureExpl te INNER JOIN Dipendenti d ON te.idxDipendente = d.idxDipendente
WHERE ((dataLav >= @inizio) AND (dataLav <= @fine))
AND isOkApp = CASE WHEN @notOkApp = 1 THEN 0 ELSE isOkApp END
AND isOkTim = CASE WHEN @notOkTim = 1 THEN 0 ELSE isOkTim END
AND isOkLav = CASE WHEN @notOkLav = 1 THEN 0 ELSE isOkLav END
ORDER BY te.CognomeNome
RETURN
go
------------------------------------------------------------------------
-- stp_timbratureExpl_getByAnomalia
--
-- Recupera la tab timbrature expl filtrando per tipo di anomalia (con AND!!!)
-- mod: S.E.L. - 2013.01.10
------------------------------------------------------------------------
create PROCEDURE stp_timbratureExpl_getByAnomalia
(
@idxDipendente INT = 0, -- 0 = tutti
@inizio DATETIME,
@fine DATETIME,
@notOkApp BIT = 0, -- 0 = tutte, 1 solo con anomalia
@notOkTim BIT = 0, -- 0 = tutte, 1 solo con anomalia
@notOkLav BIT = 0 -- 0 = tutte, 1 solo con anomalia
)
AS
SELECT *
FROM TimbratureExpl
WHERE (idxDipendente = @idxDipendente OR @idxDipendente = 0)
AND ((dataLav >= @inizio) AND (dataLav <= @fine))
AND isOkApp = CASE WHEN @notOkApp = 1 THEN 0 ELSE isOkApp END
AND isOkTim = CASE WHEN @notOkTim = 1 THEN 0 ELSE isOkTim END
AND isOkLav = CASE WHEN @notOkLav = 1 THEN 0 ELSE isOkLav END
ORDER BY dataLav DESC
RETURN
go
commit
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(210, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
+495
View File
@@ -0,0 +1,495 @@
create table zzz_RawDataPaymo(
idx int not null identity constraint PK_zzz_RawDataPaymo primary key,
Cliente nvarchar(250),
Dipendente nvarchar(250),
Progetto nvarchar(250),
TaskList nvarchar(250),
Task nvarchar(250),
Inizio datetime,
Fine datetime,
Descrizione nvarchar(2500),
Ore float
);
go
set xact_abort on;
go
begin transaction;
go
alter table RegAttivita drop
constraint DF_RegAttivita_money ,
column money;
go
alter table RegAttivita add
importo decimal(19,4) constraint DF_RegAttivita_money default ((0));
go
create index ix_idxDip on RegAttivita(idxDipendente)
include(idxFase,inizio);
go
create index ix_idxFase on RegAttivita(idxFase);
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_RA_updateQuery
*
* update attività
*
* mod: S.E.L. 2012.11.12
*
**********************************************************/
alter PROCEDURE stp_RA_updateQuery
(
@idxDipendente int,
@idxFase int,
@inizio datetime,
@fine datetime,
@descrizione nvarchar(500),
@importo decimal(19, 4),
@Original_idxRA int
)
AS
SET NOCOUNT OFF;
UPDATE RegAttivita
SET idxDipendente = @idxDipendente, idxFase = @idxFase, inizio = @inizio, fine = @fine, descrizione = @descrizione, importo = @importo
WHERE (idxRA = @Original_idxRA);
SELECT idxRA, idxDipendente, idxFase, inizio, fine, descrizione, oreTot, importo FROM RegAttivita WHERE (idxRA = @Original_idxRA)
go
/**********************************************************
* STORED stp_RA_getByKey
*
* recupera elenco attività da chiave
*
* mod: S.E.L. 2012.11.12
*
**********************************************************/
alter PROCEDURE stp_RA_getByKey
(
@idxRA INT
)
AS
SELECT idxRA, idxDipendente, idxFase, inizio, fine, CASE WHEN ISNULL(descrizione,'') = '' THEN '-' ELSE ISNULL(descrizione,'') END AS descrizione, oreTot, importo
FROM RegAttivita
WHERE idxRA = @idxRA
go
/**********************************************************
* STORED stp_RA_getByIdxDipData
*
* recupera elenco attività da idxDipendente + date
*
* mod: S.E.L. 2012.11.06
*
**********************************************************/
alter PROCEDURE stp_RA_getByIdxDipData
(
@idxDipendente INT,
@dataFrom DATETIME,
@dataTo DATETIME
)
AS
SELECT idxRA, idxDipendente, idxFase, inizio, fine, CASE WHEN ISNULL(descrizione,'') = '' THEN '-' ELSE ISNULL(descrizione,'') END AS descrizione, oreTot, importo
FROM RegAttivita
WHERE (idxDipendente = @idxDipendente) AND (inizio BETWEEN @dataFrom AND @dataTo) OR
(idxDipendente = @idxDipendente) AND (fine BETWEEN @dataFrom AND @dataTo)
ORDER BY inizio
go
/**********************************************************
* STORED stp_RA_clona
*
* clona un attività inserendola in coda alle altre del giorno x lo stesso utente, per pari durata
*
* mod: S.E.L. 2013.01.17
*
**********************************************************/
create PROCEDURE stp_RA_clona
(
@idxRA INT
)
AS
-- variabili
DECLARE @inizio DATETIME
DECLARE @dataRif DATETIME
DECLARE @idxDip INT
-- calcolo dati attività indicata
SELECT @idxDip=idxDipendente, @dataRif=dbo.DateOnly(inizio)
FROM RegAttivita
WHERE idxRA=@idxRA
-- calcolo fine ultima attività del giorno x l'utente
SELECT TOP 1 @inizio = fine
FROM RegAttivita
WHERE idxDipendente = @idxDip
AND dbo.DateOnly(fine) = @dataRif
ORDER BY fine DESC
-- ora inserisco la vera nuova attività!
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione, importo)
SELECT idxDipendente, idxFase, @inizio, DATEADD(minute, oreTot*60, @inizio), descrizione, importo
FROM RegAttivita
WHERE (idxRA = @idxRA)
go
/**********************************************************
* STORED stp_RA_deleteQuery
*
* delete attività da chiave
*
* mod: S.E.L. 2012.11.12
*
**********************************************************/
alter PROCEDURE stp_RA_deleteQuery
(
@Original_idxRA int
)
AS
SET NOCOUNT OFF;
DELETE FROM [dbo].[RegAttivita] WHERE ([idxRA] = @Original_idxRA)
go
commit;
go
set xact_abort on;
go
begin transaction;
go
create table AnagClassiOrarie(
codClasse nvarchar(10) not null constraint PK_AnagClassiOrarie primary key,
descrClasse nvarchar(250),
peso decimal(6,3)
);
go
exec sp_addextendedproperty 'MS_Description', 'codice univoco', 'SCHEMA', 'dbo', 'TABLE', 'AnagClassiOrarie', 'COLUMN', 'codClasse';
go
exec sp_addextendedproperty 'MS_Description', 'peso (per calcolo ore "produttive")', 'SCHEMA', 'dbo', 'TABLE', 'AnagClassiOrarie', 'COLUMN', 'peso';
go
commit;
go
set xact_abort on;
go
begin transaction;
go
alter table AnagFasi alter column
nomeFase nvarchar(250);
go
alter table AnagFasi add
codClasse nvarchar(10);
go
exec sp_addextendedproperty 'MS_Description', 'codice univoco', 'SCHEMA', 'dbo', 'TABLE', 'AnagFasi', 'COLUMN', 'codClasse';
go
alter table AnagFasi add
constraint FK_AnagFasi_AnagClassiOrarie foreign key(codClasse) references AnagClassiOrarie(codClasse) on update cascade;
go
set ANSI_NULLS on;
go
-- =============================================
-- Author: S.E. Locatelli
-- Create date: 2012.10.31
-- Description: Gestione trigger calcolo codFase e idxProgetto
-- =============================================
alter TRIGGER trg_AF_calcCodFaseIdxProj
ON AnagFasi
AFTER INSERT,UPDATE
AS
BEGIN
IF (@@ROWCOUNT = 0) -- SE NESSUNA RIGA AGGIORNATA O INSERITA ESCO
RETURN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- calcolo il codFase ed idxProgetto x record corrente
UPDATE AF
SET AF.codFase = dbo.f_calcolaCodFase(i.idxFase)
,AF.idxProgetto = CASE WHEN dbo.f_calcolaIdxProgetto(i.idxFase) > 0
THEN dbo.f_calcolaIdxProgetto(i.idxFase)
ELSE i.idxProgetto
END
FROM AnagFasi AF
INNER JOIN inserted i ON AF.idxFase = i.idxFase
-- aggiorno IN CASCATA i record child x idxProgetto!!!
UPDATE AF
SET AF.idxProgetto = CASE WHEN dbo.f_calcolaIdxProgetto(i.idxFase) > 0
THEN dbo.f_calcolaIdxProgetto(i.idxFase)
ELSE i.idxProgetto
END
,AF.codClasse = i.codClasse
FROM AnagFasi AF
INNER JOIN inserted i ON AF.idxFaseAncest = i.idxFase
END
go
/**********************************************************
* STORED stp_import_paymoRaw
*
* importa tracciato dati da paymo x utente e date indicate
*
* mod: S.E.L. 2012.11.20
*
**********************************************************/
create PROCEDURE stp_import_paymoRaw
(
@inizio DATETIME,
@fine DATETIME
)
AS
/**************************************************
* inizio importando eventuali clienti...
**************************************************/
;WITH myCteClienti AS
(
SELECT DISTINCT Cliente FROM zzz_RawDataPaymo
)
INSERT INTO AnagClienti(RagSociale, nota, Attivo)
SELECT cte.Cliente, cte.Cliente, 1
FROM AnagClienti anag
RIGHT OUTER JOIN myCteClienti cte ON anag.RagSociale = cte.Cliente
WHERE anag.idxCliente IS NULL
/**************************************************
* importo eventuali progetti
**************************************************/
;WITH myCteProgetti AS
(
SELECT DISTINCT Cliente, Progetto FROM zzz_RawDataPaymo
)
INSERT INTO AnagProgetti(idxCliente, nomeProj, descrProj, Attivo)
SELECT cli.idxCliente, cte.Progetto, cte.Progetto, 1
FROM AnagProgetti anag
RIGHT OUTER JOIN myCteProgetti cte ON anag.nomeProj = cte.Progetto INNER JOIN AnagClienti Cli ON Cli.RagSociale = cte.Cliente
WHERE anag.idxProgetto IS NULL
/**************************************************
* importo eventuali fasi
**************************************************/
;WITH myCteFasi AS
(
SELECT DISTINCT Cliente, Progetto, TaskList FROM zzz_RawDataPaymo
)
INSERT INTO AnagFasi(idxProgetto, codFase, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo)
SELECT Pro.idxProgetto, '', cte.TaskList, cte.TaskList, 1, 0, 1
FROM myCteFasi cte INNER JOIN AnagClienti Cli ON cte.Cliente = Cli.RagSociale INNER JOIN AnagProgetti Pro ON cte.Progetto = Pro.nomeProj
LEFT OUTER JOIN AnagFasi anag ON anag.nomeFase = cte.TaskList
WHERE anag.idxFase IS NULL
/**************************************************
* importo eventuali sottofasi
**************************************************/
;WITH myCteSubFasi AS
(
SELECT DISTINCT Cliente, Progetto, TaskList, Task FROM zzz_RawDataPaymo
)
INSERT INTO AnagFasi(idxProgetto, idxFaseAncest, codFase, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo)
SELECT Pro.idxProgetto, Fas.idxFase as idxFaseAncest, '', cte.task, cte.task, 1, 0, 1
FROM myCteSubFasi cte
INNER JOIN AnagClienti Cli ON cte.Cliente = Cli.RagSociale
INNER JOIN AnagProgetti Pro ON cte.Progetto = Pro.nomeProj -- and pro.idxCliente=cli.idxCliente
INNER JOIN AnagFasi Fas ON Fas.nomeFase = cte.TaskList AND Fas.idxProgetto = Pro.idxProgetto AND Fas.idxFaseAncest=0
LEFT OUTER JOIN AnagFasi anag ON anag.nomeFase = cte.Task AND anag.idxFaseAncest = Fas.idxFase
WHERE anag.idxFaseAncest IS NULL
/**************************************************
* importo records!
**************************************************/
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione)
SELECT Dip.idxDipendente, Fas.idxFase, cte.Inizio, cte.Fine, cte.Descrizione
FROM zzz_RawDataPaymo cte
INNER JOIN Dipendenti Dip ON cte.Dipendente = dip.codDipendenteExt
INNER JOIN AnagClienti Cli ON cte.Cliente = Cli.RagSociale
INNER JOIN AnagProgetti Pro ON cte.Progetto = Pro.nomeProj -- and pro.idxCliente=cli.idxCliente
INNER JOIN AnagFasi Fas ON Fas.nomeFase = cte.TaskList AND Fas.idxProgetto = Pro.idxProgetto AND Fas.idxFaseAncest=0
INNER JOIN AnagFasi SFas ON SFas.nomeFase = cte.Task AND SFas.idxProgetto = Pro.idxProgetto AND SFas.idxFaseAncest=fas.idxFase
LEFT OUTER JOIN RegAttivita dati ON dati.inizio = cte.Inizio AND dati.fine = cte.Fine AND dati.descrizione = cte.Descrizione AND dati.idxDipendente = Dip.idxDipendente
WHERE dati.idxRA IS NULL
RETURN
go
commit;
go
set xact_abort on;
go
begin transaction;
go
alter table Dipendenti add
codDipendenteExt nvarchar(50);
go
exec sp_addextendedproperty 'MS_Description', 'nome/codice dipendente per sistema esterno da importare', 'SCHEMA', 'dbo', 'TABLE', 'Dipendenti', 'COLUMN', 'codDipendenteExt';
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_import_paymoRaw
*
* importa tracciato dati da paymo x utente e date indicate
*
* mod: S.E.L. 2012.11.20
*
**********************************************************/
alter PROCEDURE stp_import_paymoRaw
(
@inizio DATETIME,
@fine DATETIME
)
AS
/**************************************************
* inizio importando eventuali clienti...
**************************************************/
;WITH myCteClienti AS
(
SELECT DISTINCT Cliente FROM zzz_RawDataPaymo
)
INSERT INTO AnagClienti(RagSociale, nota, Attivo)
SELECT cte.Cliente, cte.Cliente, 1
FROM AnagClienti anag
RIGHT OUTER JOIN myCteClienti cte ON anag.RagSociale = cte.Cliente
WHERE anag.idxCliente IS NULL
/**************************************************
* importo eventuali progetti
**************************************************/
;WITH myCteProgetti AS
(
SELECT DISTINCT Cliente, Progetto FROM zzz_RawDataPaymo
)
INSERT INTO AnagProgetti(idxCliente, nomeProj, descrProj, Attivo)
SELECT cli.idxCliente, cte.Progetto, cte.Progetto, 1
FROM AnagProgetti anag
RIGHT OUTER JOIN myCteProgetti cte ON anag.nomeProj = cte.Progetto INNER JOIN AnagClienti Cli ON Cli.RagSociale = cte.Cliente
WHERE anag.idxProgetto IS NULL
/**************************************************
* importo eventuali fasi
**************************************************/
;WITH myCteFasi AS
(
SELECT DISTINCT Cliente, Progetto, TaskList FROM zzz_RawDataPaymo
)
INSERT INTO AnagFasi(idxProgetto, codFase, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo)
SELECT Pro.idxProgetto, '', cte.TaskList, cte.TaskList, 1, 0, 1
FROM myCteFasi cte INNER JOIN AnagClienti Cli ON cte.Cliente = Cli.RagSociale INNER JOIN AnagProgetti Pro ON cte.Progetto = Pro.nomeProj
LEFT OUTER JOIN AnagFasi anag ON anag.nomeFase = cte.TaskList
WHERE anag.idxFase IS NULL
/**************************************************
* importo eventuali sottofasi
**************************************************/
;WITH myCteSubFasi AS
(
SELECT DISTINCT Cliente, Progetto, TaskList, Task FROM zzz_RawDataPaymo
)
INSERT INTO AnagFasi(idxProgetto, idxFaseAncest, codFase, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo)
SELECT Pro.idxProgetto, Fas.idxFase as idxFaseAncest, '', cte.task, cte.task, 1, 0, 1
FROM myCteSubFasi cte
INNER JOIN AnagClienti Cli ON cte.Cliente = Cli.RagSociale
INNER JOIN AnagProgetti Pro ON cte.Progetto = Pro.nomeProj -- and pro.idxCliente=cli.idxCliente
INNER JOIN AnagFasi Fas ON Fas.nomeFase = cte.TaskList AND Fas.idxProgetto = Pro.idxProgetto AND Fas.idxFaseAncest=0
LEFT OUTER JOIN AnagFasi anag ON anag.nomeFase = cte.Task AND anag.idxFaseAncest = Fas.idxFase
WHERE anag.idxFaseAncest IS NULL
/**************************************************
* importo records!
**************************************************/
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione)
SELECT Dip.idxDipendente, Fas.idxFase, cte.Inizio, cte.Fine, cte.Descrizione
FROM zzz_RawDataPaymo cte
INNER JOIN Dipendenti Dip ON cte.Dipendente = dip.codDipendenteExt
INNER JOIN AnagClienti Cli ON cte.Cliente = Cli.RagSociale
INNER JOIN AnagProgetti Pro ON cte.Progetto = Pro.nomeProj -- and pro.idxCliente=cli.idxCliente
INNER JOIN AnagFasi Fas ON Fas.nomeFase = cte.TaskList AND Fas.idxProgetto = Pro.idxProgetto AND Fas.idxFaseAncest=0
INNER JOIN AnagFasi SFas ON SFas.nomeFase = cte.Task AND SFas.idxProgetto = Pro.idxProgetto AND SFas.idxFaseAncest=fas.idxFase
LEFT OUTER JOIN RegAttivita dati ON dati.inizio = cte.Inizio AND dati.fine = cte.Fine AND dati.descrizione = cte.Descrizione AND dati.idxDipendente = Dip.idxDipendente
WHERE dati.idxRA IS NULL
RETURN
go
/**********************************************************
* STORED stp_AD_deleteQuery
*
* elimina un dipendente da anagrafica
*
* mod: S.E.L. 2012.10.29
*
**********************************************************/
alter PROCEDURE stp_AD_deleteQuery
(
@Original_idxDipendente int
)
AS
SET NOCOUNT OFF;
DELETE FROM [Dipendenti] WHERE (([idxDipendente] = @Original_idxDipendente))
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(230, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
File diff suppressed because it is too large Load Diff
+239
View File
@@ -0,0 +1,239 @@
create schema import;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_import_paymoRaw
*
* importa tracciato dati da paymo x utente e date indicate
*
* mod: S.E.L. 2012.11.20
*
**********************************************************/
create PROCEDURE import.stp_import_PaymoDataRaw
(
@inizio DATETIME,
@fine DATETIME
)
AS
/**************************************************
* inizio importando eventuali clienti...
**************************************************/
;WITH myCteClienti AS
(
SELECT DISTINCT Cliente FROM zzz_RawDataPaymo
)
INSERT INTO AnagClienti(RagSociale, nota, Attivo)
SELECT cte.Cliente, cte.Cliente, 1
FROM AnagClienti anag
RIGHT OUTER JOIN myCteClienti cte ON anag.RagSociale = cte.Cliente
WHERE anag.idxCliente IS NULL
/**************************************************
* importo eventuali progetti
**************************************************/
;WITH myCteProgetti AS
(
SELECT DISTINCT Cliente, Progetto FROM zzz_RawDataPaymo
)
INSERT INTO AnagProgetti(idxCliente, nomeProj, descrProj, Attivo)
SELECT cli.idxCliente, cte.Progetto, cte.Progetto, 1
FROM AnagProgetti anag
RIGHT OUTER JOIN myCteProgetti cte ON anag.nomeProj = cte.Progetto INNER JOIN AnagClienti Cli ON Cli.RagSociale = cte.Cliente
WHERE anag.idxProgetto IS NULL
/**************************************************
* importo eventuali fasi
**************************************************/
;WITH myCteFasi AS
(
SELECT DISTINCT Cliente, Progetto, TaskList FROM zzz_RawDataPaymo
)
INSERT INTO AnagFasi(idxProgetto, codFase, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo)
SELECT Pro.idxProgetto, '', cte.TaskList, cte.TaskList, 1, 0, 1
FROM myCteFasi cte INNER JOIN AnagClienti Cli ON cte.Cliente = Cli.RagSociale INNER JOIN AnagProgetti Pro ON cte.Progetto = Pro.nomeProj
LEFT OUTER JOIN AnagFasi anag ON anag.nomeFase = cte.TaskList
WHERE anag.idxFase IS NULL
/**************************************************
* importo eventuali sottofasi
**************************************************/
;WITH myCteSubFasi AS
(
SELECT DISTINCT Cliente, Progetto, TaskList, Task FROM zzz_RawDataPaymo
)
INSERT INTO AnagFasi(idxProgetto, idxFaseAncest, codFase, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo)
SELECT Pro.idxProgetto, Fas.idxFase as idxFaseAncest, '', cte.task, cte.task, 1, 0, 1
FROM myCteSubFasi cte
INNER JOIN AnagClienti Cli ON cte.Cliente = Cli.RagSociale
INNER JOIN AnagProgetti Pro ON cte.Progetto = Pro.nomeProj -- and pro.idxCliente=cli.idxCliente
INNER JOIN AnagFasi Fas ON Fas.nomeFase = cte.TaskList AND Fas.idxProgetto = Pro.idxProgetto AND Fas.idxFaseAncest=0
LEFT OUTER JOIN AnagFasi anag ON anag.nomeFase = cte.Task AND anag.idxFaseAncest = Fas.idxFase
WHERE anag.idxFaseAncest IS NULL
/**************************************************
* importo records!
**************************************************/
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione)
SELECT Dip.idxDipendente, Fas.idxFase, cte.Inizio, cte.Fine, cte.Descrizione
FROM zzz_RawDataPaymo cte
INNER JOIN Dipendenti Dip ON cte.Dipendente = dip.codDipendenteExt
INNER JOIN AnagClienti Cli ON cte.Cliente = Cli.RagSociale
INNER JOIN AnagProgetti Pro ON cte.Progetto = Pro.nomeProj -- and pro.idxCliente=cli.idxCliente
INNER JOIN AnagFasi Fas ON Fas.nomeFase = cte.TaskList AND Fas.idxProgetto = Pro.idxProgetto AND Fas.idxFaseAncest=0
INNER JOIN AnagFasi SFas ON SFas.nomeFase = cte.Task AND SFas.idxProgetto = Pro.idxProgetto AND SFas.idxFaseAncest=fas.idxFase
LEFT OUTER JOIN RegAttivita dati ON dati.inizio = cte.Inizio AND dati.fine = cte.Fine AND dati.descrizione = cte.Descrizione AND dati.idxDipendente = Dip.idxDipendente
WHERE dati.idxRA IS NULL
RETURN
go
/**********************************************************
* STORED stp_import_paymoRaw
*
* importa tracciato dati da paymo x utente e date indicate
*
* mod: S.E.L. 2012.11.20
*
**********************************************************/
create PROCEDURE import.stp_import_SpsDataRaw
(
@inizio DATETIME,
@fine DATETIME
)
AS
/**************************************************
* inizio importando eventuali clienti...
**************************************************/
;WITH myCteClienti AS
(
SELECT DISTINCT Cliente FROM zzz_RawDataPaymo
)
INSERT INTO AnagClienti(RagSociale, nota, Attivo)
SELECT cte.Cliente, cte.Cliente, 1
FROM AnagClienti anag
RIGHT OUTER JOIN myCteClienti cte ON anag.RagSociale = cte.Cliente
WHERE anag.idxCliente IS NULL
/**************************************************
* importo eventuali progetti
**************************************************/
;WITH myCteProgetti AS
(
SELECT DISTINCT Cliente, Progetto FROM zzz_RawDataPaymo
)
INSERT INTO AnagProgetti(idxCliente, nomeProj, descrProj, Attivo)
SELECT cli.idxCliente, cte.Progetto, cte.Progetto, 1
FROM AnagProgetti anag
RIGHT OUTER JOIN myCteProgetti cte ON anag.nomeProj = cte.Progetto INNER JOIN AnagClienti Cli ON Cli.RagSociale = cte.Cliente
WHERE anag.idxProgetto IS NULL
/**************************************************
* importo eventuali fasi
**************************************************/
;WITH myCteFasi AS
(
SELECT DISTINCT Cliente, Progetto, TaskList FROM zzz_RawDataPaymo
)
INSERT INTO AnagFasi(idxProgetto, codFase, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo)
SELECT Pro.idxProgetto, '', cte.TaskList, cte.TaskList, 1, 0, 1
FROM myCteFasi cte INNER JOIN AnagClienti Cli ON cte.Cliente = Cli.RagSociale INNER JOIN AnagProgetti Pro ON cte.Progetto = Pro.nomeProj
LEFT OUTER JOIN AnagFasi anag ON anag.nomeFase = cte.TaskList
WHERE anag.idxFase IS NULL
/**************************************************
* importo eventuali sottofasi
**************************************************/
;WITH myCteSubFasi AS
(
SELECT DISTINCT Cliente, Progetto, TaskList, Task FROM zzz_RawDataPaymo
)
INSERT INTO AnagFasi(idxProgetto, idxFaseAncest, codFase, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo)
SELECT Pro.idxProgetto, Fas.idxFase as idxFaseAncest, '', cte.task, cte.task, 1, 0, 1
FROM myCteSubFasi cte
INNER JOIN AnagClienti Cli ON cte.Cliente = Cli.RagSociale
INNER JOIN AnagProgetti Pro ON cte.Progetto = Pro.nomeProj -- and pro.idxCliente=cli.idxCliente
INNER JOIN AnagFasi Fas ON Fas.nomeFase = cte.TaskList AND Fas.idxProgetto = Pro.idxProgetto AND Fas.idxFaseAncest=0
LEFT OUTER JOIN AnagFasi anag ON anag.nomeFase = cte.Task AND anag.idxFaseAncest = Fas.idxFase
WHERE anag.idxFaseAncest IS NULL
/**************************************************
* importo records!
**************************************************/
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione)
SELECT Dip.idxDipendente, Fas.idxFase, cte.Inizio, cte.Fine, cte.Descrizione
FROM zzz_RawDataPaymo cte
INNER JOIN Dipendenti Dip ON cte.Dipendente = dip.codDipendenteExt
INNER JOIN AnagClienti Cli ON cte.Cliente = Cli.RagSociale
INNER JOIN AnagProgetti Pro ON cte.Progetto = Pro.nomeProj -- and pro.idxCliente=cli.idxCliente
INNER JOIN AnagFasi Fas ON Fas.nomeFase = cte.TaskList AND Fas.idxProgetto = Pro.idxProgetto AND Fas.idxFaseAncest=0
INNER JOIN AnagFasi SFas ON SFas.nomeFase = cte.Task AND SFas.idxProgetto = Pro.idxProgetto AND SFas.idxFaseAncest=fas.idxFase
LEFT OUTER JOIN RegAttivita dati ON dati.inizio = cte.Inizio AND dati.fine = cte.Fine AND dati.descrizione = cte.Descrizione AND dati.idxDipendente = Dip.idxDipendente
WHERE dati.idxRA IS NULL
RETURN
go
commit;
go
drop procedure stp_import_paymoRaw;
go
set xact_abort on;
go
begin transaction;
go
alter table AnagClienti add
codExt nvarchar(50);
go
exec sp_addextendedproperty 'MS_Description', 'codice esterno', 'SCHEMA', 'dbo', 'TABLE', 'AnagClienti', 'COLUMN', 'codExt';
go
set ANSI_NULLS on;
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(251, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,51 @@
/**************************************************
* update cognome nome dipendenti
**************************************************/
UPDATE Dipendenti
SET codDipendenteExt = Nome + ' ' + Cognome
UPDATE Dipendenti
SET codDipendenteExt='Bohdan Khomonchak'
WHERE cognome='Khomonchak'
/**************************************************
* importo records!
**************************************************/
-- faccio un sort x dipendente-giorno x accodare i records
-- faccio un sort x dipendente-giorno x accodare i records
;WITH myCteStep1 AS
(
SELECT CognomeNome
,Data
, ROW_NUMBER() OVER(PARTITION BY CognomeNome,Data ORDER BY CognomeNome,Data) as riga
, codCom
, Fase
, attivita
, durata*60 as minuti
, descrizione
FROM zzz_rawData_SPS
)
, myCteStep2 AS
(
SELECT *
, DATEADD(MINUTE,480+120*(riga-1),Data) AS Inizio
, DATEADD(MINUTE,480+120*(riga-1)+minuti,Data) AS Fine
FROM myCteStep1
)
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione)
SELECT Dip.idxDipendente, Fas.idxFase, cte.Inizio,cte.Fine, ISNULL(cte.Descrizione,'-')
FROM myCteStep2 cte
INNER JOIN Dipendenti Dip ON cte.CognomeNome = dip.codDipendenteExt
INNER JOIN AnagProgetti Pro ON cte.codCom = Pro.codExt -- and pro.idxCliente=cli.idxCliente
INNER JOIN AnagFasi Fas ON Fas.nomeFase = cte.Fase AND Fas.idxProgetto = Pro.idxProgetto AND Fas.idxFaseAncest=0
INNER JOIN AnagFasi SFas ON SFas.nomeFase = cte.attivita AND SFas.idxProgetto = Pro.idxProgetto AND SFas.idxFaseAncest=fas.idxFase
LEFT OUTER JOIN RegAttivita dati ON dati.inizio = cte.Inizio AND dati.fine = cte.Fine AND dati.descrizione = cte.Descrizione AND dati.idxDipendente = Dip.idxDipendente
WHERE dati.idxRA IS NULL
--- forzo ricalcolo attività expl!
EXEC stp_ricalcolaRegAttivitaExpl_byPeriodoUser 0, '20120101', '20130120'
+656
View File
@@ -0,0 +1,656 @@
set xact_abort on;
go
begin transaction;
go
alter table AnagProgetti add
avvio datetime,
chiusura datetime;
go
set ANSI_NULLS on;
go
commit;
go
set xact_abort on;
go
begin transaction;
go
create index ix_RA_inizio on RegAttivita(inizio)
include(idxDipendente,idxFase,fine);
go
set ANSI_NULLS on;
go
alter TRIGGER trg_RegAtt_upsert
ON RegAttivita
/*----------------------------------
* Trigger su insert/update
*
* Aggiorna la tab dei RegAttivitaExpl
*
* creato da: S.E. Locatelli - 2013.01.21
* ultima modifica:
*----------------------------------*/
FOR INSERT, UPDATE
AS
IF(UPDATE(idxDipendente) OR UPDATE(inizio) OR UPDATE(fine) OR UPDATE(idxFase))
BEGIN
-- dichiarazione variabili
DECLARE @inizio DATETIME
DECLARE @fine DATETIME
DECLARE @idxDipendente INT
-- recupero valori x inserting
SELECT @inizio = DATEADD(DAY,-1,CONVERT(DATE,i.inizio)), @fine = DATEADD(DAY,1,CONVERT(DATE,i.inizio)), @idxDipendente = i.idxDipendente FROM inserted i
--chiamo la stored di ricalcolo
EXEC stp_ricalcolaRegAttivitaExpl_byPeriodoUser @idxDipendente, @inizio, @fine
END
go
alter TRIGGER trg_RegAtt_delete
ON RegAttivita
/*----------------------------------
* Trigger su delete
*
* Aggiorna la tab RegAttivitaExpl ricalcolando la giornata del record interessato
*
* creato da: S.E. Locatelli - 2013.01.21
* ultima modifica:
*----------------------------------*/
FOR DELETE
AS
-- dichiarazione variabili
DECLARE @inizio DATETIME
DECLARE @fine DATETIME
DECLARE @idxDipendente INT
-- recupero valori x inserting
SELECT @inizio = DATEADD(DAY,-1,CONVERT(DATE,d.inizio)), @fine = DATEADD(DAY,1,CONVERT(DATE,d.inizio)), @idxDipendente = d.idxDipendente FROM deleted d
--chiamo la stored di ricalcolo
EXEC stp_ricalcolaRegAttivitaExpl_byPeriodoUser @idxDipendente, @inizio, @fine
go
commit;
go
set xact_abort on;
go
begin transaction;
go
alter table RegAttivita drop
constraint DF_RegAttivita_money ,
constraint FK_RegAttivita_AnagFasi ,
constraint FK_RegAttivita_Dipendenti ;
go
exec sp_rename 'PK_RegAttivita', 'tmp__PK_RegAttivita', 'OBJECT';
go
exec sp_rename 'RegAttivita', 'tmp__RegAttivita_0', 'OBJECT';
go
drop trigger trg_RegAtt_upsert;
go
drop trigger trg_RegAtt_delete;
go
create table RegAttivita(
idxRA int not null identity constraint PK_RegAttivita primary key,
idxDipendente int not null,
idxFase int not null,
inizio datetime not null,
fine datetime not null,
descrizione nvarchar(500),
oreTot decimal(18,0),
importo decimal(19,4) constraint DF_RegAttivita_money default ((0))
);
go
alter table RegAttivita add
constraint FK_RegAttivita_AnagFasi foreign key(idxFase) references AnagFasi(idxFase) on update cascade,
constraint FK_RegAttivita_Dipendenti foreign key(idxDipendente) references Dipendenti(idxDipendente) on update cascade;
go
create index ix_idxDip on RegAttivita(idxDipendente)
include(idxFase,inizio);
go
create index ix_idxFase on RegAttivita(idxFase);
go
create index ix_inizio on RegAttivita(inizio,idxDipendente)
include(fine);
go
create index ix_RA_inizio on RegAttivita(inizio)
include(idxDipendente,idxFase,fine);
go
exec sp_addextendedproperty 'MS_Description', '([dbo].[f_hourInterval]([inizio],[fine]))', 'SCHEMA', 'dbo', 'TABLE', 'RegAttivita', 'COLUMN', 'oreTot';
go
set identity_insert RegAttivita on;
go
insert into RegAttivita(idxRA,idxDipendente,idxFase,inizio,fine,descrizione,oreTot,importo) select idxRA,idxDipendente,idxFase,inizio,fine,descrizione,convert(decimal(18,0), oreTot),importo from tmp__RegAttivita_0;
go
set identity_insert RegAttivita off;
go
drop table tmp__RegAttivita_0;
go
set ANSI_NULLS on;
go
create TRIGGER trg_RegAtt_upsert
ON RegAttivita
/*----------------------------------
* Trigger su insert/update
*
* Aggiorna la tab dei RegAttivitaExpl
*
* creato da: S.E. Locatelli - 2013.01.21
* ultima modifica:
*----------------------------------*/
FOR INSERT, UPDATE
AS
IF(UPDATE(idxDipendente) OR UPDATE(inizio) OR UPDATE(fine) OR UPDATE(idxFase))
BEGIN
-- dichiarazione variabili
DECLARE @inizio DATETIME
DECLARE @fine DATETIME
DECLARE @idxDipendente INT
-- recupero valori x inserting
SELECT @inizio = DATEADD(DAY,-1,CONVERT(DATE,i.inizio)), @fine = DATEADD(DAY,1,CONVERT(DATE,i.inizio)), @idxDipendente = i.idxDipendente FROM inserted i
--chiamo la stored di ricalcolo
EXEC stp_ricalcolaRegAttivitaExpl_byPeriodoUser @idxDipendente, @inizio, @fine
END
go
create TRIGGER trg_RegAtt_delete
ON RegAttivita
/*----------------------------------
* Trigger su delete
*
* Aggiorna la tab RegAttivitaExpl ricalcolando la giornata del record interessato
*
* creato da: S.E. Locatelli - 2013.01.21
* ultima modifica:
*----------------------------------*/
FOR DELETE
AS
-- dichiarazione variabili
DECLARE @inizio DATETIME
DECLARE @fine DATETIME
DECLARE @idxDipendente INT
-- recupero valori x inserting
SELECT @inizio = DATEADD(DAY,-1,CONVERT(DATE,d.inizio)), @fine = DATEADD(DAY,1,CONVERT(DATE,d.inizio)), @idxDipendente = d.idxDipendente FROM deleted d
--chiamo la stored di ricalcolo
EXEC stp_ricalcolaRegAttivitaExpl_byPeriodoUser @idxDipendente, @inizio, @fine
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/******************************************************************************
* Function f_hourInterval
*
* calcola intervallo orario tra 2 date/time
*******************************************************************************/
alter FUNCTION f_hourInterval
(
@inizio DATETIME,
@fine DATETIME
)
RETURNS DECIMAL(19,4)
AS
BEGIN
-- sommo e restituisco tot ore
RETURN CAST(dbo.f_minuteInterval(@inizio,@fine) AS DECIMAL(19,4))/60
END
go
commit;
go
set xact_abort on;
go
begin transaction;
go
alter table RegAttivita drop
constraint DF_RegAttivita_money ,
constraint FK_RegAttivita_AnagFasi ,
constraint FK_RegAttivita_Dipendenti ;
go
exec sp_rename 'PK_RegAttivita', 'tmp__PK_RegAttivita', 'OBJECT';
go
exec sp_rename 'RegAttivita', 'tmp__RegAttivita_1', 'OBJECT';
go
drop trigger trg_RegAtt_delete;
go
drop trigger trg_RegAtt_upsert;
go
create table RegAttivita(
idxRA int not null identity constraint PK_RegAttivita primary key,
idxDipendente int not null,
idxFase int not null,
inizio datetime not null,
fine datetime not null,
descrizione nvarchar(500),
oreTot as ([dbo].[f_hourInterval]([inizio],[fine])),
importo decimal(19,4) constraint DF_RegAttivita_money default ((0))
);
go
alter table RegAttivita add
constraint FK_RegAttivita_AnagFasi foreign key(idxFase) references AnagFasi(idxFase) on update cascade,
constraint FK_RegAttivita_Dipendenti foreign key(idxDipendente) references Dipendenti(idxDipendente) on update cascade;
go
create index ix_idxDip on RegAttivita(idxDipendente)
include(idxFase,inizio);
go
create index ix_idxFase on RegAttivita(idxFase);
go
create index ix_inizio on RegAttivita(inizio,idxDipendente)
include(fine);
go
create index ix_RA_inizio on RegAttivita(inizio)
include(idxDipendente,idxFase,fine);
go
exec sp_addextendedproperty 'MS_Description', '([dbo].[f_hourInterval]([inizio],[fine]))', 'SCHEMA', 'dbo', 'TABLE', 'RegAttivita', 'COLUMN', 'oreTot';
go
set identity_insert RegAttivita on;
go
insert into RegAttivita(idxRA,idxDipendente,idxFase,inizio,fine,descrizione,importo) select idxRA,idxDipendente,idxFase,inizio,fine,descrizione,importo from tmp__RegAttivita_1;
go
set identity_insert RegAttivita off;
go
drop table tmp__RegAttivita_1;
go
set ANSI_NULLS on;
go
create TRIGGER trg_RegAtt_delete
ON RegAttivita
/*----------------------------------
* Trigger su delete
*
* Aggiorna la tab RegAttivitaExpl ricalcolando la giornata del record interessato
*
* creato da: S.E. Locatelli - 2013.01.21
* ultima modifica:
*----------------------------------*/
FOR DELETE
AS
-- dichiarazione variabili
DECLARE @inizio DATETIME
DECLARE @fine DATETIME
DECLARE @idxDipendente INT
-- recupero valori x inserting
SELECT @inizio = DATEADD(DAY,-1,CONVERT(DATE,d.inizio)), @fine = DATEADD(DAY,1,CONVERT(DATE,d.inizio)), @idxDipendente = d.idxDipendente FROM deleted d
--chiamo la stored di ricalcolo
EXEC stp_ricalcolaRegAttivitaExpl_byPeriodoUser @idxDipendente, @inizio, @fine
go
create TRIGGER trg_RegAtt_upsert
ON RegAttivita
/*----------------------------------
* Trigger su insert/update
*
* Aggiorna la tab dei RegAttivitaExpl
*
* creato da: S.E. Locatelli - 2013.01.21
* ultima modifica:
*----------------------------------*/
FOR INSERT, UPDATE
AS
IF(UPDATE(idxDipendente) OR UPDATE(inizio) OR UPDATE(fine) OR UPDATE(idxFase))
BEGIN
-- dichiarazione variabili
DECLARE @inizio DATETIME
DECLARE @fine DATETIME
DECLARE @idxDipendente INT
-- recupero valori x inserting
SELECT @inizio = DATEADD(DAY,-1,CONVERT(DATE,i.inizio)), @fine = DATEADD(DAY,1,CONVERT(DATE,i.inizio)), @idxDipendente = i.idxDipendente FROM inserted i
--chiamo la stored di ricalcolo
EXEC stp_ricalcolaRegAttivitaExpl_byPeriodoUser @idxDipendente, @inizio, @fine
END
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_AP_Expl_getData
*
* recupera elenco progetti con filtraggio ore totali per
* - dipendente
* - periodo
*
* mod: S.E.L. 2012.11.06
*
**********************************************************/
create PROCEDURE stp_AP_Expl_getData
(
@idxDipendente INT = 0, -- 0 = tutti
@dataFrom DATETIME = '19000101',
@dataTo DATETIME = '21000101',
@idxCliente INT = 0, -- 0 = tutti
@showPrjArch BIT = 1 -- 1 = mostra tutti
)
AS
-- controllo se date nulle importo a min/max
DECLARE @firstDate DATETIME
DECLARE @lastDate DATETIME
SELECT @firstDate = MIN(inizio), @lastDate=DATEADD(DAY,1,MAX(inizio)) FROM RegAttivita
SELECT @dataFrom=ISNULL(@dataFrom, @firstDate) , @dataTo=ISNULL(@dataTo, @lastDate)
;WITH myCTE AS
(
SELECT ap.idxProgetto, SUM(ISNULL(ra.oreTot, 0)) AS totOre
FROM AnagProgetti AS ap INNER JOIN
AnagClienti AS ac ON ac.idxCliente=ap.idxCliente INNER JOIN
AnagFasi AS af ON ap.idxProgetto = af.idxProgetto INNER JOIN
RegAttivita AS ra ON af.idxFase = ra.idxFase
WHERE (ra.idxDipendente = @idxDipendente OR @idxDipendente = 0)
AND (ra.inizio >= @dataFrom AND ra.inizio <= @dataTo)
AND (ac.idxCliente = @idxCliente OR @idxCliente = 0)
AND (ap.Attivo = CASE WHEN @showPrjArch <> 0 THEN ap.Attivo ELSE 1 END)
GROUP BY ap.idxProgetto
)
SELECT ac.RagSociale
, ap.idxProgetto
, ap.idxCliente
, ap.nomeProj
, ap.descrProj
, ISNULL(ap.budgetTime,0) AS budgetTime
, ISNULL(ap.budgetMoney,0) AS budgetMoney
, ISNULL(ap.OldIdx,-1) AS OldIdx
, ap.Attivo
, ISNULL(ap.codExt,'') AS codExt
, ISNULL(cte.totOre, 0) AS totOre
FROM AnagClienti AS ac INNER JOIN
AnagProgetti AS ap ON ac.idxCliente = ap.idxCliente LEFT OUTER JOIN
myCte AS cte ON cte.idxProgetto = ap.idxProgetto
--ORDER BY cte.totOre DESC
go
/**********************************************************
* STORED stp_RA_clonaLastRA_Utente
*
* clona un attività utente: se c'è da ultima altrimenti da zero x una certa data
*
* mod: S.E.L. 2013.01.17
*
**********************************************************/
create PROCEDURE stp_RA_clonaLastRA_Utente
(
@idxDipendente INT,
@dataRif DATETIME -- data x cui creare un record attività
)
AS
-- variabili
DECLARE @idxFase INT
DECLARE @idxRA INT
-- arrotondo data richiesta solo all'ora...
SELECT @dataRif = DATEADD(HOUR, DATEPART(HOUR,@dataRif), CONVERT(DATETIME,(CONVERT(DATE,@dataRif))))
-- cerco se esista ultima reg attività utente...
SELECT @idxRA=ISNULL(idxRA,0) FROM RegAttivita WHERE idxDipendente = @idxDipendente
-- se non ho trovato records, ovvero idxRA = 0, prendo ultima fase da elenco
IF (@idxRA = 0)
BEGIN
-- calcolo ultima fase inserita...
SELECT TOP 1 @idxFase=ISNULL(idxFase,0) FROM AnagFasi ORDER BY idxFase DESC
-- se trovata fase inserisco!
IF(@idxFase > 0)
BEGIN
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (@idxDipendente, @idxFase, @dataRif, DATEADD(HOUR,1,@dataRif), '...',0)
END
END
ELSE
BEGIN
-- inserisco su data richeista duplicazione dell'ultima attività utente...
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione, importo)
SELECT idxDipendente, idxFase, @dataRif, DATEADD(minute, DATEDIFF(MINUTE, inizio, fine), @dataRif), descrizione, importo
FROM RegAttivita
WHERE (idxRA = @idxRA)
END
go
create PROCEDURE stp_RA_InsertQuery
(
@idxDipendente int,
@idxFase int,
@inizio datetime,
@fine datetime,
@descrizione nvarchar(500),
@importo decimal(19, 4)
)
AS
SET NOCOUNT OFF;
INSERT INTO RegAttivita
(idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (@idxDipendente,@idxFase,@inizio,@fine,@descrizione,@importo)
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_RAD_Expl_getByIdxDipData
*
* recupera elenco attività (con Expl dei dati da anagrafica) da idxDipendente + dataRif
*
* mod: S.E.L. 2013.01.23
*
**********************************************************/
alter PROCEDURE stp_RAD_Expl_getByIdxDipData
(
@idxDipendente INT,
@dataRif DATETIME
)
AS
SELECT RegAttivita.idxDipendente, RegAttivita.inizio, RegAttivita.fine, CASE WHEN ISNULL(descrizione, '') = '' THEN '-' ELSE ISNULL(descrizione, '')
END AS descrizione, RegAttivita.oreTot, RegAttivita.oreTot * 60 AS minTot, RegAttivita.importo, AnagClienti.RagSociale, AnagProgetti.nomeProj,
AnagFasi.nomeFase, RegAttivita.idxRA
FROM RegAttivita INNER JOIN
AnagFasi ON RegAttivita.idxFase = AnagFasi.idxFase INNER JOIN
AnagProgetti ON AnagFasi.idxProgetto = AnagProgetti.idxProgetto INNER JOIN
AnagClienti ON AnagProgetti.idxCliente = AnagClienti.idxCliente
WHERE (RegAttivita.idxDipendente = @idxDipendente) AND (CAST(RegAttivita.inizio AS DATE) = CAST(@dataRif AS DATE) OR
CAST(RegAttivita.fine AS DATE) = CAST(@dataRif AS DATE))
ORDER BY RegAttivita.inizio
go
/*----------------------------------
* stp_ricalcolaRegAttivitaExpl_byPeriodoUser
*
* Ricalcola le RegAttivitaExpl x utente e intervallo date
* mod: S.E.L. - 2013.01.21
*----------------------------------*/
alter PROCEDURE stp_ricalcolaRegAttivitaExpl_byPeriodoUser
(
@idxDipendente INT = 0,
@inizio DATETIME,
@fine DATETIME
)
AS
-- dichiaro variabili x calcolo tempo execuzione e num records!
DECLARE @startProc DATETIME = GETDATE()
DECLARE @totRecords INT = 0
BEGIN
-- faccio una tab temporanea con tallyTable x calcolo periodo intero...
DECLARE @numD INT
SET @numD = ( SELECT DATEDIFF(dd, @inizio, @fine ) )
-- crea eventuali record mancanti: data, dip, cognome-nome
INSERT INTO RegAttivitaExpl(dataLav, idxDipendente)
SELECT ty.Data, ty.idxDipendente
FROM (
SELECT CONVERT(DATE,DATEADD(dd, -N, @fine)) as Data, idxDipendente
FROM Tally, Dipendenti
WHERE N <= @numD -- solo dati desiderati
AND (idxDipendente = @idxDipendente OR @idxDipendente = 0) --filtro su dipendenti
) ty LEFT OUTER JOIN RegAttivitaExpl rae ON ty.Data=rae.dataLav AND ty.idxDipendente=rae.idxDipendente
WHERE rae.dataLav IS NULL -- righe mancanti!
-- resetto a zero le eventuali righe che non hanno attività registrate
UPDATE rae
SET minRegAtt = 0
,descrProj = ''
FROM RegAttivitaExpl rae
LEFT OUTER JOIN (
SELECT DISTINCT idxDipendente, CONVERT(DATE,inizio) AS data
FROM dbo.RegAttivita
WHERE (idxDipendente = @idxDipendente OR @idxDipendente = 0) AND (inizio >= DATEADD(DAY,-1,@inizio) AND inizio <= @fine)
GROUP BY idxDipendente, CONVERT(DATE,inizio)
) vra ON rae.dataLav = vra.data AND rae.idxDipendente=vra.idxDipendente
WHERE vra.data IS NULL -- righe mancanti!
AND ((rae.idxDipendente = @idxDipendente OR @idxDipendente = 0) AND (rae.dataLav >= @inizio AND rae.dataLav < @fine)) -- solo x dip e periodo selezionati
-- tab temp del record date progetti
;WITH myCteRA AS(
SELECT idxDipendente, CONVERT(DATE,inizio) AS data, SUM(oreTot) AS oreTot, SUM(dbo.f_minuteInterval(inizio, fine)) as minTot, dbo.f_ProgettiByDate(idxDipendente, CONVERT(DATE,inizio)) AS progetti
FROM dbo.RegAttivita
WHERE (idxDipendente = @idxDipendente OR @idxDipendente = 0) AND (inizio >= DATEADD(DAY,-1,@inizio) AND inizio <= @fine)
GROUP BY idxDipendente, CONVERT(DATE,inizio)
)
-- aggiorno la tab delle RegAttivitaExpl
UPDATE rae
SET minRegAtt = minTot
,descrProj = ISNULL(progetti,'')
FROM RegAttivitaExpl rae
INNER JOIN myCteRA vra ON rae.dataLav = vra.data AND rae.idxDipendente=vra.idxDipendente
-- aggiorno cognome nome
BEGIN TRY
UPDATE rae
SET CognomeNome = ISNULL(vcn.CognomeNome,'')
FROM RegAttivitaExpl rae INNER JOIN v_cognomeNome vcn ON rae.idxDipendente = vcn.idxDipendente
WHERE ISNULL(rae.CognomeNome,'') = ''
END TRY
BEGIN CATCH
-- non faccio nulla
END CATCH
END
SELECT @numD = @numD * COUNT(*) FROM Dipendenti WHERE (idxDipendente = @idxDipendente OR @idxDipendente = 0)
SELECT @startProc AS startTime, GETDATE() AS endTime, @numD AS numRec, DATEDIFF(ms, @startProc, GETDATE()) AS totMs, CAST(@numD AS FLOAT) * 1000 / DATEDIFF(ms, @startProc, GETDATE()) AS recPerSec
RETURN
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(255, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
@@ -0,0 +1,470 @@
set xact_abort on
go
begin transaction
go
set identity_insert dbo.zzz_rawData_SPS on
go
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (255, N'1932_101', '2012-09-18 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Stampo 2 impronte + modello del pezzo', '2013-01-21 00:00:00.000', N'Daniele Vanotti', 9.5, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (256, N'1932_101', '2012-09-18 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Stampo 2 impronte + modello del pezzo', '2013-01-22 00:00:00.000', N'Daniele Vanotti', 10.5, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (257, N'1932_101', '2012-09-18 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Stampo 2 impronte + modello del pezzo', '2013-01-23 00:00:00.000', N'Daniele Vanotti', 9.5, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (258, N'1932_101', '2012-09-18 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Stampo 2 impronte + modello del pezzo', '2013-01-24 00:00:00.000', N'Daniele Vanotti', 9.5, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (259, N'1950_338', '2012-12-04 00:00:00.000', N'Gilardoni Vittorio Srl', N'Progettazione conchigia + casse anima', '2013-01-21 00:00:00.000', N'Andrea Manzinali', 5, N'attrezzature2D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (260, N'1950_338', '2012-12-04 00:00:00.000', N'Gilardoni Vittorio Srl', N'Progettazione conchigia + casse anima', '2013-01-22 00:00:00.000', N'Andrea Manzinali', 1, N'attrezzature2D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (261, N'1950_338', '2012-12-04 00:00:00.000', N'Gilardoni Vittorio Srl', N'Progettazione conchigia + casse anima', '2013-01-24 00:00:00.000', N'Andrea Manzinali', 0.5, N'attrezzature2D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (262, N'1950_338', '2012-12-04 00:00:00.000', N'Gilardoni Vittorio Srl', N'Progettazione conchigia + casse anima', '2013-01-25 00:00:00.000', N'Andrea Manzinali', 0.5, N'attrezzature2D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (263, N'1957_101', '2013-01-07 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Progetto stampo trancia', '2013-01-21 00:00:00.000', N'Davide Colleoni', 7, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (264, N'1957_101', '2013-01-07 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Progetto stampo trancia', '2013-01-22 00:00:00.000', N'Davide Colleoni', 9, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (265, N'1957_101', '2013-01-07 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Progetto stampo trancia', '2013-01-23 00:00:00.000', N'Davide Colleoni', 9, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (266, N'1957_101', '2013-01-07 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Progetto stampo trancia', '2013-01-24 00:00:00.000', N'Davide Colleoni', 9, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (267, N'1957_101', '2013-01-07 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Progetto stampo trancia', '2013-01-25 00:00:00.000', N'Davide Colleoni', 6, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (268, N'1957_101', '2013-01-07 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Progetto stampo trancia', '2013-01-21 00:00:00.000', N'Ivan Ferraroli', 8, N'attrezzature3D', N'trancia 277 culle')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (269, N'1957_101', '2013-01-07 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Progetto stampo trancia', '2013-01-22 00:00:00.000', N'Ivan Ferraroli', 8, N'attrezzature3D', N'trancia 277 distanziali')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (270, N'1957_101', '2013-01-07 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Progetto stampo trancia', '2013-01-23 00:00:00.000', N'Ivan Ferraroli', 8, N'attrezzature3D', N'trancia 277 ')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (271, N'1957_101', '2013-01-07 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Progetto stampo trancia', '2013-01-24 00:00:00.000', N'Ivan Ferraroli', 8, N'attrezzature3D', N'trancia 277')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (272, N'1957_101', '2013-01-07 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Progetto stampo trancia', '2013-01-25 00:00:00.000', N'Ivan Ferraroli', 8, N'attrezzature3D', N'trancia-rinomina-distinta')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (273, N'1958_173', '2013-01-07 00:00:00.000', N'Persico', N'Sella di raffreddamento', '2013-01-24 00:00:00.000', N'Walter Salvi', 1, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (274, N'1959_173', '2013-01-07 00:00:00.000', N'Persico', N'Sella di raffreddamento', '2013-01-24 00:00:00.000', N'Walter Salvi', 1.5, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (275, N'1960_173', '2013-01-07 00:00:00.000', N'Persico', N'Sella di raffreddamento', '2013-01-24 00:00:00.000', N'Walter Salvi', 1, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (276, N'1961_173', '2013-01-07 00:00:00.000', N'Persico', N'Sella di raffreddamento', '2013-01-24 00:00:00.000', N'Walter Salvi', 1, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (277, N'1962_101', '2013-01-08 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Modifiche stampo - HONDA DX - EX 1836', '2013-01-25 00:00:00.000', N'Davide Colleoni', 3, N'attrezzature3D', N'RIGENERAZIONE COLATA')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (278, N'1964_101', '2013-01-08 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Modello del pezzo + Progetto stampo a 1 impronta', '2013-01-21 00:00:00.000', N'Andrea Manzinali', 3, N'prodotto3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (279, N'1964_101', '2013-01-08 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Modello del pezzo + Progetto stampo a 1 impronta', '2013-01-22 00:00:00.000', N'Andrea Manzinali', 7, N'prodotto3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (280, N'1964_101', '2013-01-08 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Modello del pezzo + Progetto stampo a 1 impronta', '2013-01-23 00:00:00.000', N'Andrea Manzinali', 9, N'prodotto3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (281, N'1964_101', '2013-01-08 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Modello del pezzo + Progetto stampo a 1 impronta', '2013-01-24 00:00:00.000', N'Andrea Manzinali', 8, N'prodotto3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (282, N'1964_101', '2013-01-08 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Modello del pezzo + Progetto stampo a 1 impronta', '2013-01-25 00:00:00.000', N'Andrea Manzinali', 4.5, N'prodotto3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (283, N'1964_101', '2013-01-08 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Modello del pezzo + Progetto stampo a 1 impronta', '2013-01-26 00:00:00.000', N'Andrea Manzinali', 4, N'prodotto3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (284, N'1968_101', '2013-01-10 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Rotazione stampo', '2013-01-21 00:00:00.000', N'Walter Salvi', 2, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (285, N'1968_101', '2013-01-10 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Rotazione stampo', '2013-01-22 00:00:00.000', N'Walter Salvi', 9.5, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (286, N'1968_101', '2013-01-10 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Rotazione stampo', '2013-01-23 00:00:00.000', N'Walter Salvi', 9.5, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (287, N'1968_101', '2013-01-10 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Rotazione stampo', '2013-01-24 00:00:00.000', N'Walter Salvi', 4.5, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (288, N'1968_101', '2013-01-10 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Rotazione stampo', '2013-01-25 00:00:00.000', N'Walter Salvi', 8.5, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (289, N'1968_101', '2013-01-10 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Rotazione stampo', '2013-01-21 00:00:00.000', N'Bohdan Khomonchak', 4, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (290, N'1968_101', '2013-01-10 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Rotazione stampo', '2013-01-22 00:00:00.000', N'Bohdan Khomonchak', 4, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (291, N'1968_101', '2013-01-10 00:00:00.000', N'Fonderie Mario Mazzucconi', N'Rotazione stampo', '2013-01-23 00:00:00.000', N'Bohdan Khomonchak', 4, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (292, N'1969_173', '2013-01-11 00:00:00.000', N'Persico', N'Stampo completo', '2013-01-21 00:00:00.000', N'Walter Salvi', 7.5, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (293, N'1969_173', '2013-01-11 00:00:00.000', N'Persico', N'Stampo completo', '2013-01-24 00:00:00.000', N'Walter Salvi', 0.5, N'attrezzature3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (294, N'1970_341', '2013-01-16 00:00:00.000', N'PANMECCANICA', N'introduzione delle lavorazioni + disegni 2D', '2013-01-21 00:00:00.000', N'Matteo Leggeri', 8, N'prodotto3D', N'')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (295, N'1970_341', '2013-01-16 00:00:00.000', N'PANMECCANICA', N'introduzione delle lavorazioni + disegni 2D', '2013-01-22 00:00:00.000', N'Matteo Leggeri', 8, N'prodotto3D', N'6 ore corpo valvola + 2 ore coperchio')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (296, N'1970_341', '2013-01-16 00:00:00.000', N'PANMECCANICA', N'introduzione delle lavorazioni + disegni 2D', '2013-01-23 00:00:00.000', N'Matteo Leggeri', 9, N'prodotto3D', N'5 ore coperchio--- 4ore power unit')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (297, N'1970_341', '2013-01-16 00:00:00.000', N'PANMECCANICA', N'introduzione delle lavorazioni + disegni 2D', '2013-01-24 00:00:00.000', N'Matteo Leggeri', 8, N'prodotto3D', N'power unit')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (298, N'1970_341', '2013-01-16 00:00:00.000', N'PANMECCANICA', N'introduzione delle lavorazioni + disegni 2D', '2013-01-25 00:00:00.000', N'Matteo Leggeri', 8, N'prodotto3D', N'power unit')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (299, N'1970_341', '2013-01-16 00:00:00.000', N'PANMECCANICA', N'introduzione delle lavorazioni + disegni 2D', '2013-01-26 00:00:00.000', N'Matteo Leggeri', 2, N'attrezzature2D', N'corpo valvola')
INSERT INTO dbo.zzz_rawData_SPS
(ID, codCom, inizioCom, cliente, Fase, Data, CognomeNome, durata, attivita, descrizione)
VALUES (300, N'1970_341', '2013-01-16 00:00:00.000', N'PANMECCANICA', N'introduzione delle lavorazioni + disegni 2D', '2013-01-26 00:00:00.000', N'Matteo Leggeri', 2, N'prodotto3D', N'power unit')
go
set identity_insert dbo.zzz_rawData_SPS off
go
commit transaction
go
set xact_abort on
go
begin transaction
go
set identity_insert dbo.RegAttivita on
go
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (257, 2, 4, '2013-01-21 08:00:00.000', '2013-01-21 13:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (258, 2, 4, '2013-01-22 10:00:00.000', '2013-01-22 11:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (259, 2, 4, '2013-01-24 10:00:00.000', '2013-01-24 10:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (260, 2, 4, '2013-01-25 08:00:00.000', '2013-01-25 08:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (261, 2, 15, '2013-01-21 10:00:00.000', '2013-01-21 13:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (262, 2, 15, '2013-01-22 08:00:00.000', '2013-01-22 15:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (263, 2, 15, '2013-01-23 08:00:00.000', '2013-01-23 17:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (264, 2, 15, '2013-01-24 08:00:00.000', '2013-01-24 16:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (265, 2, 15, '2013-01-25 10:00:00.000', '2013-01-25 14:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (266, 2, 15, '2013-01-26 08:00:00.000', '2013-01-26 12:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (267, 3, 8, '2013-01-21 08:00:00.000', '2013-01-21 15:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (268, 3, 8, '2013-01-22 08:00:00.000', '2013-01-22 17:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (269, 3, 8, '2013-01-23 08:00:00.000', '2013-01-23 17:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (270, 3, 8, '2013-01-24 08:00:00.000', '2013-01-24 17:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (271, 3, 8, '2013-01-25 08:00:00.000', '2013-01-25 14:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (272, 3, 13, '2013-01-25 10:00:00.000', '2013-01-25 13:00:00.000', N'RIGENERAZIONE COLATA', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (273, 4, 3, '2013-01-21 08:00:00.000', '2013-01-21 17:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (274, 4, 3, '2013-01-22 08:00:00.000', '2013-01-22 18:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (275, 4, 3, '2013-01-23 08:00:00.000', '2013-01-23 17:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (276, 4, 3, '2013-01-24 08:00:00.000', '2013-01-24 17:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (277, 6, 9, '2013-01-24 12:00:00.000', '2013-01-24 13:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (278, 6, 10, '2013-01-24 14:00:00.000', '2013-01-24 15:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (279, 6, 11, '2013-01-24 16:00:00.000', '2013-01-24 17:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (280, 6, 12, '2013-01-24 18:00:00.000', '2013-01-24 19:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (281, 6, 19, '2013-01-21 10:00:00.000', '2013-01-21 12:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (282, 6, 19, '2013-01-22 08:00:00.000', '2013-01-22 17:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (283, 6, 19, '2013-01-23 08:00:00.000', '2013-01-23 17:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (284, 6, 19, '2013-01-24 08:00:00.000', '2013-01-24 12:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (285, 6, 19, '2013-01-25 08:00:00.000', '2013-01-25 16:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (286, 6, 20, '2013-01-21 08:00:00.000', '2013-01-21 15:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (287, 6, 20, '2013-01-24 10:00:00.000', '2013-01-24 10:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (288, 7, 8, '2013-01-21 08:00:00.000', '2013-01-21 16:00:00.000', N'trancia 277 culle', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (289, 7, 8, '2013-01-22 08:00:00.000', '2013-01-22 16:00:00.000', N'trancia 277 distanziali', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (290, 7, 8, '2013-01-23 08:00:00.000', '2013-01-23 16:00:00.000', N'trancia 277 ', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (291, 7, 8, '2013-01-24 08:00:00.000', '2013-01-24 16:00:00.000', N'trancia 277', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (292, 7, 8, '2013-01-25 08:00:00.000', '2013-01-25 16:00:00.000', N'trancia-rinomina-distinta', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (293, 8, 70, '2013-01-26 08:00:00.000', '2013-01-26 10:00:00.000', N'corpo valvola', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (294, 8, 70, '2013-01-21 08:00:00.000', '2013-01-21 16:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (295, 8, 70, '2013-01-22 08:00:00.000', '2013-01-22 16:00:00.000', N'6 ore corpo valvola + 2 ore coperchio', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (296, 8, 70, '2013-01-23 08:00:00.000', '2013-01-23 17:00:00.000', N'5 ore coperchio--- 4ore power unit', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (297, 8, 70, '2013-01-24 08:00:00.000', '2013-01-24 16:00:00.000', N'power unit', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (298, 8, 70, '2013-01-25 08:00:00.000', '2013-01-25 16:00:00.000', N'power unit', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (299, 8, 70, '2013-01-26 10:00:00.000', '2013-01-26 12:00:00.000', N'power unit', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (300, 11, 19, '2013-01-21 08:00:00.000', '2013-01-21 12:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (301, 11, 19, '2013-01-22 08:00:00.000', '2013-01-22 12:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (302, 11, 19, '2013-01-23 08:00:00.000', '2013-01-23 12:00:00.000', N'', 0.0000)
go
set identity_insert dbo.RegAttivita off
go
commit transaction
go
set xact_abort on
go
begin transaction
go
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-20', 5, N'Spreafico Roberto [900008]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-20', 9, N'Gervasoni Lucia [900013]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-20', 10, N'Rota Nodari Giambattista [900002]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-21', 5, N'Spreafico Roberto [900008]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-21', 9, N'Gervasoni Lucia [900013]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-21', 10, N'Rota Nodari Giambattista [900002]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-22', 5, N'Spreafico Roberto [900008]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-22', 9, N'Gervasoni Lucia [900013]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-22', 10, N'Rota Nodari Giambattista [900002]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-23', 5, N'Spreafico Roberto [900008]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-23', 9, N'Gervasoni Lucia [900013]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-23', 10, N'Rota Nodari Giambattista [900002]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-24', 5, N'Spreafico Roberto [900008]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-24', 9, N'Gervasoni Lucia [900013]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-24', 10, N'Rota Nodari Giambattista [900002]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-24', 11, N'Khomonchak Bohdan [900014]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-25', 4, N'Vanotti Daniele [900006]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-25', 5, N'Spreafico Roberto [900008]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-25', 9, N'Gervasoni Lucia [900013]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-25', 10, N'Rota Nodari Giambattista [900002]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-25', 11, N'Khomonchak Bohdan [900014]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-26', 3, N'Colleoni Davide [900010]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-26', 4, N'Vanotti Daniele [900006]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-26', 5, N'Spreafico Roberto [900008]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-26', 6, N'Salvi Walter [900004]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-26', 7, N'Ferraroli Ivan [900016]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-26', 9, N'Gervasoni Lucia [900013]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-26', 10, N'Rota Nodari Giambattista [900002]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-26', 11, N'Khomonchak Bohdan [900014]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-27', 2, N'Manzinali Andrea [900011]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-27', 3, N'Colleoni Davide [900010]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-27', 4, N'Vanotti Daniele [900006]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-27', 5, N'Spreafico Roberto [900008]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-27', 6, N'Salvi Walter [900004]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-27', 7, N'Ferraroli Ivan [900016]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-27', 8, N'Leggeri Matteo [900015]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-27', 9, N'Gervasoni Lucia [900013]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-27', 10, N'Rota Nodari Giambattista [900002]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-27', 11, N'Khomonchak Bohdan [900014]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-28', 2, N'Manzinali Andrea [900011]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-28', 3, N'Colleoni Davide [900010]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-28', 4, N'Vanotti Daniele [900006]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-28', 5, N'Spreafico Roberto [900008]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-28', 6, N'Salvi Walter [900004]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-28', 7, N'Ferraroli Ivan [900016]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-28', 8, N'Leggeri Matteo [900015]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-28', 9, N'Gervasoni Lucia [900013]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-28', 10, N'Rota Nodari Giambattista [900002]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-28', 11, N'Khomonchak Bohdan [900014]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-29', 2, N'Manzinali Andrea [900011]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-29', 3, N'Colleoni Davide [900010]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-29', 4, N'Vanotti Daniele [900006]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-29', 5, N'Spreafico Roberto [900008]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-29', 6, N'Salvi Walter [900004]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-29', 7, N'Ferraroli Ivan [900016]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-29', 8, N'Leggeri Matteo [900015]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-29', 9, N'Gervasoni Lucia [900013]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-29', 10, N'Rota Nodari Giambattista [900002]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-29', 11, N'Khomonchak Bohdan [900014]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-30', 2, N'Manzinali Andrea [900011]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-30', 3, N'Colleoni Davide [900010]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-30', 4, N'Vanotti Daniele [900006]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-30', 5, N'Spreafico Roberto [900008]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-30', 6, N'Salvi Walter [900004]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-30', 7, N'Ferraroli Ivan [900016]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-30', 8, N'Leggeri Matteo [900015]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-30', 9, N'Gervasoni Lucia [900013]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-30', 10, N'Rota Nodari Giambattista [900002]', 0, N'')
INSERT INTO dbo.RegAttivitaExpl
VALUES ('2013-01-30', 11, N'Khomonchak Bohdan [900014]', 0, N'')
go
commit transaction
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(256, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
@@ -0,0 +1,299 @@
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_import_SpsDataRaw
*
* importa tracciato dati SPS x utente e date indicate
*
* mod: S.E.L. 2012.11.20
*
**********************************************************/
alter PROCEDURE import.stp_import_SpsDataRaw
(
@inizio DATETIME,
@fine DATETIME
)
AS
/**************************************************
* inizio importando eventuali clienti...
**************************************************/
;WITH myCteClienti AS
(
select * from ZZZ_SPS_AnagClienti
)
INSERT INTO AnagClienti(RagSociale, indirizzo, cap, citta, prov, nota, oldIdx, Attivo, codExt)
SELECT cte.RagSoc, cte.Indirizzo, cte.cap, cte.citta, cte.prov, cte.codCliExt +' - ' + cte.RagSoc, cte.idxCli, 1,cte.codCliExt
FROM AnagClienti anag
RIGHT OUTER JOIN myCteClienti cte ON anag.RagSociale = cte.RagSoc
WHERE anag.idxCliente IS NULL
/**************************************************
* importo eventuali progetti
**************************************************/
;WITH myCteProgetti AS
(
SELECT * FROM ZZZ_SPS_AnagCommesse
)
INSERT INTO AnagProgetti(idxCliente, nomeProj, descrProj, budgetTime, Attivo, codExt)
SELECT cli.idxCliente, cte.codExt, cte.Descrizione + ' ['+ISNULL(cte.Codice_Disegno,' - ')+']', cte.BudgetOre, 1, cte.codExt
FROM AnagProgetti anag
RIGHT OUTER JOIN myCteProgetti cte ON anag.nomeProj = cte.codExt INNER JOIN
AnagClienti Cli ON Cli.codExt = RIGHT(cte.codExt,3)
WHERE anag.idxProgetto IS NULL
/**************************************************
* importo eventuali fasi
**************************************************/
;WITH myCteFasi AS
(
SELECT DISTINCT codCom, Fase FROM zzz_rawData_SPS
)
INSERT INTO AnagFasi(idxProgetto, codFase, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo)
SELECT Pro.idxProgetto, '', cte.Fase, cte.Fase, 1, 0, 1
FROM myCteFasi cte INNER JOIN AnagProgetti Pro ON cte.codCom = Pro.codExt
LEFT OUTER JOIN AnagFasi anag ON anag.nomeFase = cte.Fase
WHERE anag.idxFase IS NULL
/**************************************************
* importo eventuali sottofasi
**************************************************/
;WITH myCteSubFasi AS
(
SELECT DISTINCT codCom, Fase, attivita FROM zzz_rawData_SPS
)
INSERT INTO AnagFasi(idxProgetto, idxFaseAncest, codFase, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo)
SELECT Pro.idxProgetto, Fas.idxFase as idxFaseAncest, '', cte.attivita, cte.attivita, 1, 0, 1
FROM myCteSubFasi cte
INNER JOIN AnagProgetti Pro ON cte.codCom = Pro.codExt
INNER JOIN AnagFasi Fas ON Fas.nomeFase = cte.Fase AND Fas.idxProgetto = Pro.idxProgetto AND Fas.idxFaseAncest=0
LEFT OUTER JOIN AnagFasi anag ON anag.nomeFase = cte.attivita AND anag.idxFaseAncest = Fas.idxFase
WHERE anag.idxFaseAncest IS NULL
/**************************************************
* update cognome nome dipendenti
**************************************************/
UPDATE Dipendenti
SET codDipendenteExt = Nome + ' ' + Cognome
UPDATE Dipendenti
SET codDipendenteExt='Bohdan Khomonchak'
WHERE cognome='Khomonchak'
/**************************************************
* importo records!
**************************************************/
-- faccio un sort x dipendente-giorno x accodare i records
-- faccio un sort x dipendente-giorno x accodare i records
;WITH myCteStep1 AS
(
SELECT CognomeNome
,Data
, ROW_NUMBER() OVER(PARTITION BY CognomeNome,Data ORDER BY CognomeNome,Data) as riga
, codCom
, Fase
, attivita
, durata*60 as minuti
, descrizione
FROM zzz_rawData_SPS
)
, myCteStep2 AS
(
SELECT *
, DATEADD(MINUTE,480+120*(riga-1),Data) AS Inizio
, DATEADD(MINUTE,480+120*(riga-1)+minuti,Data) AS Fine
FROM myCteStep1
)
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione)
SELECT Dip.idxDipendente, SFas.idxFase, cte.Inizio,cte.Fine, ISNULL(cte.Descrizione,'-')
FROM myCteStep2 cte
INNER JOIN Dipendenti Dip ON cte.CognomeNome = dip.codDipendenteExt
INNER JOIN AnagProgetti Pro ON cte.codCom = Pro.codExt -- and pro.idxCliente=cli.idxCliente
INNER JOIN AnagFasi Fas ON Fas.nomeFase = cte.Fase AND Fas.idxProgetto = Pro.idxProgetto AND Fas.idxFaseAncest=0
INNER JOIN AnagFasi SFas ON SFas.nomeFase = cte.attivita AND SFas.idxProgetto = Pro.idxProgetto AND SFas.idxFaseAncest=fas.idxFase
LEFT OUTER JOIN RegAttivita dati ON dati.inizio = cte.Inizio AND dati.fine = cte.Fine AND dati.descrizione = cte.Descrizione AND dati.idxDipendente = Dip.idxDipendente
WHERE dati.idxRA IS NULL
--- forzo ricalcolo attività expl!
EXEC stp_ricalcolaRegAttivitaExpl_byPeriodoUser 0, '20120101', '20130131'
RETURN
go
commit;
go
truncate table regattivita
-- faccio un sort x dipendente-giorno x accodare i records
;WITH myCteStep1 AS
(
SELECT CognomeNome
,Data
, ROW_NUMBER() OVER(PARTITION BY CognomeNome,Data ORDER BY CognomeNome,Data) as riga
, codCom
, Fase
, attivita
, durata*60 as minuti
, descrizione
FROM zzz_rawData_SPS
)
, myCteStep2 AS
(
SELECT *
, DATEADD(MINUTE,480+120*(riga-1),Data) AS Inizio
, DATEADD(MINUTE,480+120*(riga-1)+minuti,Data) AS Fine
FROM myCteStep1
)
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione)
SELECT Dip.idxDipendente, SFas.idxFase, cte.Inizio,cte.Fine, ISNULL(cte.Descrizione,'-')
FROM myCteStep2 cte
INNER JOIN Dipendenti Dip ON cte.CognomeNome = dip.codDipendenteExt
INNER JOIN AnagProgetti Pro ON cte.codCom = Pro.codExt -- and pro.idxCliente=cli.idxCliente
INNER JOIN AnagFasi Fas ON Fas.nomeFase = cte.Fase AND Fas.idxProgetto = Pro.idxProgetto AND Fas.idxFaseAncest=0
INNER JOIN AnagFasi SFas ON SFas.nomeFase = cte.attivita AND SFas.idxProgetto = Pro.idxProgetto AND SFas.idxFaseAncest=fas.idxFase
LEFT OUTER JOIN RegAttivita dati ON dati.inizio = cte.Inizio AND dati.fine = cte.Fine AND dati.descrizione = cte.Descrizione AND dati.idxDipendente = Dip.idxDipendente
WHERE dati.idxRA IS NULL
select * from RegAttivita
select * from RegAttivitaExpl
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
alter TRIGGER trg_RegAtt_upsert
ON RegAttivita
/*----------------------------------
* Trigger su insert/update
*
* Aggiorna la tab dei RegAttivitaExpl
*
* creato da: S.E. Locatelli - 2013.01.21
* ultima modifica:
*----------------------------------*/
FOR INSERT, UPDATE
AS
IF(UPDATE(idxDipendente) OR UPDATE(inizio) OR UPDATE(fine) OR UPDATE(idxFase))
BEGIN
-- dichiarazione variabili
DECLARE @inizio DATETIME
DECLARE @fine DATETIME
DECLARE @idxDipendente INT
-- recupero valori OLD
SELECT @inizio = DATEADD(DAY,-1,CONVERT(DATE,d.inizio)), @fine = DATEADD(DAY,1,CONVERT(DATE,d.inizio)), @idxDipendente = d.idxDipendente FROM deleted d
--chiamo la stored di ricalcolo
EXEC stp_ricalcolaRegAttivitaExpl_byPeriodoUser @idxDipendente, @inizio, @fine
-- recupero valori NEW
SELECT @inizio = DATEADD(DAY,-1,CONVERT(DATE,i.inizio)), @fine = DATEADD(DAY,1,CONVERT(DATE,i.inizio)), @idxDipendente = i.idxDipendente FROM inserted i
--chiamo la stored di ricalcolo
EXEC stp_ricalcolaRegAttivitaExpl_byPeriodoUser @idxDipendente, @inizio, @fine
END
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_RA_clonaLastRA_Utente
*
* clona un attività utente: se c'è da ultima altrimenti da zero x una certa data
*
* mod: S.E.L. 2013.01.17
*
**********************************************************/
alter PROCEDURE stp_RA_clonaLastRA_Utente
(
@idxDipendente INT,
@dataRif DATETIME -- data x cui creare un record attività
)
AS
-- variabili
DECLARE @idxFase INT
DECLARE @idxRA INT
-- arrotondo data richiesta solo all'ora...
SELECT @dataRif = DATEADD(HOUR, DATEPART(HOUR,@dataRif), CONVERT(DATETIME,(CONVERT(DATE,@dataRif))))
-- cerco se esista ultima reg attività utente...
SELECT @idxRA=ISNULL((SELECT idxRA FROM RegAttivita WHERE idxDipendente = @idxDipendente),0)
-- se non ho trovato records, ovvero idxRA = 0, prendo ultima fase da elenco
IF (@idxRA = 0)
BEGIN
-- calcolo ultima fase inserita...
SELECT TOP 1 @idxFase=ISNULL(idxFase,0) FROM AnagFasi ORDER BY idxFase DESC
-- se trovata fase inserisco!
IF(@idxFase > 0)
BEGIN
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (@idxDipendente, @idxFase, @dataRif, DATEADD(HOUR,1,@dataRif), '...',0)
END
END
ELSE
BEGIN
-- inserisco su data richeista duplicazione dell'ultima attività utente...
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione, importo)
SELECT idxDipendente, idxFase, @dataRif, DATEADD(minute, DATEDIFF(MINUTE, inizio, fine), @dataRif), descrizione, importo
FROM RegAttivita
WHERE (idxRA = @idxRA)
END
go
commit;
go
+744
View File
@@ -0,0 +1,744 @@
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_import_paymoRaw
*
* importa tracciato dati da paymo x utente e date indicate
*
* mod: S.E.L. 2012.11.20
*
**********************************************************/
alter PROCEDURE import.stp_import_PaymoDataRaw
(
@inizio DATETIME,
@fine DATETIME
)
AS
/**************************************************
* inizio importando eventuali clienti...
**************************************************/
;WITH myCteClienti AS
(
SELECT DISTINCT Cliente FROM zzz_RawDataPaymo
)
INSERT INTO AnagClienti(RagSociale, nota, Attivo)
SELECT cte.Cliente, cte.Cliente, 1
FROM AnagClienti anag
RIGHT OUTER JOIN myCteClienti cte ON anag.RagSociale = cte.Cliente
WHERE anag.idxCliente IS NULL
/**************************************************
* importo eventuali progetti
**************************************************/
;WITH myCteProgetti AS
(
SELECT DISTINCT Cliente, Progetto FROM zzz_RawDataPaymo
)
INSERT INTO AnagProgetti(idxCliente, nomeProj, descrProj, Attivo)
SELECT cli.idxCliente, cte.Progetto, cte.Progetto, 1
FROM AnagProgetti anag
RIGHT OUTER JOIN myCteProgetti cte ON anag.nomeProj = cte.Progetto INNER JOIN AnagClienti Cli ON Cli.RagSociale = cte.Cliente
WHERE anag.idxProgetto IS NULL
/**************************************************
* importo eventuali fasi
**************************************************/
;WITH myCteFasi AS
(
SELECT DISTINCT Cliente, Progetto, TaskList FROM zzz_RawDataPaymo
)
INSERT INTO AnagFasi(idxProgetto, codFase, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo)
SELECT Pro.idxProgetto, '', cte.TaskList, cte.TaskList, 1, 0, 1
FROM myCteFasi cte INNER JOIN AnagClienti Cli ON cte.Cliente = Cli.RagSociale INNER JOIN AnagProgetti Pro ON cte.Progetto = Pro.nomeProj
LEFT OUTER JOIN AnagFasi anag ON anag.nomeFase = cte.TaskList AND anag.idxProgetto=pro.idxProgetto
WHERE anag.idxFase IS NULL
/**************************************************
* importo eventuali sottofasi
**************************************************/
;WITH myCteSubFasi AS
(
SELECT DISTINCT Cliente, Progetto, TaskList, Task FROM zzz_RawDataPaymo
)
INSERT INTO AnagFasi(idxProgetto, idxFaseAncest, codFase, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo)
SELECT Pro.idxProgetto, Fas.idxFase as idxFaseAncest, '', cte.task, cte.task, 1, 0, 1
FROM myCteSubFasi cte
INNER JOIN AnagClienti Cli ON cte.Cliente = Cli.RagSociale
INNER JOIN AnagProgetti Pro ON cte.Progetto = Pro.nomeProj -- and pro.idxCliente=cli.idxCliente
INNER JOIN AnagFasi Fas ON Fas.nomeFase = cte.TaskList AND Fas.idxProgetto = Pro.idxProgetto AND Fas.idxFaseAncest=0
LEFT OUTER JOIN AnagFasi anag ON anag.nomeFase = cte.Task AND anag.idxFaseAncest = Fas.idxFase
WHERE anag.idxFaseAncest IS NULL
/**************************************************
* importo records!
**************************************************/
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione)
SELECT Dip.idxDipendente, SFas.idxFase, cte.Inizio, cte.Fine, cte.Descrizione
FROM zzz_RawDataPaymo cte
INNER JOIN Dipendenti Dip ON cte.Dipendente = dip.codDipendenteExt
INNER JOIN AnagClienti Cli ON cte.Cliente = Cli.RagSociale
INNER JOIN AnagProgetti Pro ON cte.Progetto = Pro.nomeProj -- and pro.idxCliente=cli.idxCliente
INNER JOIN AnagFasi Fas ON Fas.nomeFase = cte.TaskList AND Fas.idxProgetto = Pro.idxProgetto AND Fas.idxFaseAncest=0
INNER JOIN AnagFasi SFas ON SFas.nomeFase = cte.Task AND SFas.idxProgetto = Pro.idxProgetto AND SFas.idxFaseAncest=fas.idxFase
LEFT OUTER JOIN RegAttivita dati ON dati.inizio = cte.Inizio AND dati.fine = cte.Fine AND dati.descrizione = cte.Descrizione AND dati.idxDipendente = Dip.idxDipendente
WHERE dati.idxRA IS NULL
RETURN
go
commit;
go
set xact_abort on;
go
begin transaction;
go
alter table AnagFasi add
budgetTime decimal(19,4);
go
exec sp_addextendedproperty 'MS_Description', 'Budget del progetto (in ore)', 'SCHEMA', 'dbo', 'TABLE', 'AnagFasi', 'COLUMN', 'budgetTime';
go
alter table AnagFasi add
budgetMoney decimal(19,4);
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_AF_getByIdxProj
*
* elenco fasi da progetto
*
* mod: S.E.L. 2012.10.31
*
**********************************************************/
alter PROCEDURE stp_AF_getByIdxProj
(
@idxProgetto INT
)
AS
SET NOCOUNT ON;
/*
SELECT idxFase, idxProgetto, codFase, idxFaseAncest, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo, codClasse, codExt
FROM AnagFasi
WHERE (idxProgetto = @idxProgetto)
ORDER BY codFase
*/
-- dichiaro variabili "accessorie"
DECLARE @idxDipendente INT = 0 -- 0 = tutti
DECLARE @dataFrom DATETIME = '19000101'
DECLARE @dataTo DATETIME = '99991231'
-- controllo se date nulle importo a min/max
DECLARE @firstDate DATETIME
DECLARE @lastDate DATETIME
SELECT @firstDate = MIN(inizio), @lastDate=DATEADD(DAY,1,MAX(inizio)) FROM RegAttivita
SELECT @dataFrom = ISNULL(@dataFrom, @firstDate), @dataTo=ISNULL(@dataTo, @lastDate)
;WITH myCTE AS
(
SELECT af.idxFase, SUM(ISNULL(ra.oreTot, 0)) AS totOre
FROM AnagFasi AS af INNER JOIN
RegAttivita AS ra ON af.idxFase = ra.idxFase
WHERE (ra.idxDipendente = @idxDipendente OR @idxDipendente = 0)
AND (ra.inizio >= @dataFrom AND ra.inizio <= @dataTo)
AND (af.idxProgetto = @idxProgetto OR @idxProgetto = 0)
GROUP BY af.idxFase
)
SELECT af.idxFase
, af.idxProgetto
, af.codFase
, af.idxFaseAncest
, af.nomeFase
, af.descrizioneFase
, af.enableTime
, af.enableMoney
, af.Attivo
, ISNULL(af.budgetTime,0) AS budgetTime
, ISNULL(af.budgetMoney,0) AS budgetMoney
, ISNULL(af.codClasse,'') AS codClasse
, ISNULL(af.codExt, '') AS codExt
, ISNULL(cte.totOre, 0) AS totOre
FROM AnagFasi AS af LEFT OUTER JOIN
myCte AS cte ON cte.idxFase = af.idxFase
WHERE (af.idxProgetto = @idxProgetto OR @idxProgetto = 0)
ORDER BY af.nomeFase , af.codFase
go
/**********************************************************
* STORED stp_AF_getByIdxFase
*
* recupera fasi da idx
*
* mod: S.E.L. 2012.11.12
*
**********************************************************/
alter PROCEDURE stp_AF_getByIdxFase
(
@idxFase INT
)
AS
SET NOCOUNT ON;
/*
SELECT *
FROM AnagFasi
WHERE @idxFase = idxFase
*/
-- dichiaro variabili "accessorie"
DECLARE @idxDipendente INT = 0 -- 0 = tutti
DECLARE @dataFrom DATETIME = '19000101'
DECLARE @dataTo DATETIME = '99991231'
-- controllo se date nulle importo a min/max
DECLARE @firstDate DATETIME
DECLARE @lastDate DATETIME
SELECT @firstDate = MIN(inizio), @lastDate=DATEADD(DAY,1,MAX(inizio)) FROM RegAttivita
SELECT @dataFrom = ISNULL(@dataFrom, @firstDate), @dataTo=ISNULL(@dataTo, @lastDate)
;WITH myCTE AS
(
SELECT af.idxFase, SUM(ISNULL(ra.oreTot, 0)) AS totOre
FROM AnagFasi AS af INNER JOIN
RegAttivita AS ra ON af.idxFase = ra.idxFase
WHERE (ra.idxDipendente = @idxDipendente OR @idxDipendente = 0)
AND (ra.inizio >= @dataFrom AND ra.inizio <= @dataTo)
AND (af.idxFase = @idxFase)
GROUP BY af.idxFase
)
SELECT af.idxFase
, af.idxProgetto
, af.codFase
, af.idxFaseAncest
, af.nomeFase
, af.descrizioneFase
, af.enableTime
, af.enableMoney
, af.Attivo
, ISNULL(af.budgetTime,0) AS budgetTime
, ISNULL(af.budgetMoney,0) AS budgetMoney
, ISNULL(af.codClasse,'') AS codClasse
, ISNULL(af.codExt, '') AS codExt
, ISNULL(cte.totOre, 0) AS totOre
FROM AnagFasi AS af LEFT OUTER JOIN
myCte AS cte ON cte.idxFase = af.idxFase
WHERE (af.idxFase = @idxFase)
go
/**********************************************************
* STORED stp_AF_Expl_getData
*
* recupera elenco fasi con filtraggio ore totali per
* - dipendente
* - periodo
*
* mod: S.E.L. 2013.01.31
*
**********************************************************/
create PROCEDURE stp_AF_Expl_getData
(
@idxDipendente INT = 0, -- 0 = tutti
@dataFrom DATETIME = '19000101',
@dataTo DATETIME = '99991231',
@idxProgetto INT = 0
)
AS
-- controllo se date nulle importo a min/max
DECLARE @firstDate DATETIME
DECLARE @lastDate DATETIME
SELECT @firstDate = MIN(inizio), @lastDate=DATEADD(DAY,1,MAX(inizio)) FROM RegAttivita
SELECT @dataFrom = ISNULL(@dataFrom, @firstDate), @dataTo=ISNULL(@dataTo, @lastDate)
;WITH myCTE AS
(
SELECT af.idxFase, SUM(ISNULL(ra.oreTot, 0)) AS totOre
FROM AnagFasi AS af INNER JOIN
RegAttivita AS ra ON af.idxFase = ra.idxFase
WHERE (ra.idxDipendente = @idxDipendente OR @idxDipendente = 0)
AND (ra.inizio >= @dataFrom AND ra.inizio <= @dataTo)
AND (af.idxProgetto = @idxProgetto OR @idxProgetto = 0)
GROUP BY af.idxFase
)
SELECT af.idxFase
, af.idxProgetto
, af.codFase
, af.idxFaseAncest
, af.nomeFase
, af.descrizioneFase
, af.enableTime
, af.enableMoney
, af.Attivo
, ISNULL(af.budgetTime,0) AS budgetTime
, ISNULL(af.budgetMoney,0) AS budgetMoney
, ISNULL(af.codClasse,'') AS codClasse
, ISNULL(af.codExt, '') AS codExt
, ISNULL(cte.totOre, 0) AS totOre
FROM AnagFasi AS af LEFT OUTER JOIN
myCte AS cte ON cte.idxFase = af.idxFase
WHERE (af.idxProgetto = @idxProgetto OR @idxProgetto = 0)
ORDER BY af.nomeFase , af.codFase
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
alter VIEW v_selProgetti
AS
SELECT dbo.AnagProgetti.idxProgetto AS value, dbo.AnagClienti.RagSociale + ' - ' + dbo.AnagProgetti.nomeProj AS label, dbo.AnagClienti.idxCliente AS conditio
FROM dbo.AnagClienti INNER JOIN
dbo.AnagProgetti ON dbo.AnagClienti.idxCliente = dbo.AnagProgetti.idxCliente
WHERE (dbo.AnagProgetti.Attivo = 1)
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_AF_getLastByIdxDipendente
*
* elenco ULTIME fasi dato dipendente
*
* mod: S.E.L. 2012.11.09
*
**********************************************************/
alter PROCEDURE stp_AF_getLastByIdxDipendente
(
@idxDipendente INT,
@num2show INT
)
AS
SET NOCOUNT ON;
;WITH myCTE AS(
SELECT TOP(@num2show) *
FROM RegAttivita
WHERE idxDipendente = @idxDipendente
ORDER BY inizio DESC
)
SELECT *, 0 AS totOre
FROM AnagFasi
WHERE idxFase IN (
SELECT DISTINCT idxFase FROM myCTE
UNION
SELECT DISTINCT af.idxFaseAncest FROM AnagFasi af INNER JOIN myCTE ra ON af.idxFase=ra.idxFase
)
ORDER BY codFase
go
/**********************************************************
* STORED stp_AP_Expl_getData
*
* recupera elenco progetti con filtraggio ore totali per
* - dipendente
* - periodo
*
* mod: S.E.L. 2013.01.30
*
**********************************************************/
alter PROCEDURE stp_AP_Expl_getData
(
@idxDipendente INT = 0, -- 0 = tutti
@dataFrom DATETIME = '19000101',
@dataTo DATETIME = '99991231',
@idxCliente INT = 0, -- 0 = tutti
@showPrjArch BIT = 1 -- 1 = mostra tutti
)
AS
-- controllo se date nulle importo a min/max
DECLARE @firstDate DATETIME
DECLARE @lastDate DATETIME
SELECT @firstDate = MIN(inizio), @lastDate=DATEADD(DAY,1,MAX(inizio)) FROM RegAttivita
SELECT @dataFrom=ISNULL(@dataFrom, @firstDate) , @dataTo=ISNULL(@dataTo, @lastDate)
;WITH myCTE AS
(
SELECT ap.idxProgetto, SUM(ISNULL(ra.oreTot, 0)) AS totOre
FROM AnagProgetti AS ap INNER JOIN
AnagClienti AS ac ON ac.idxCliente=ap.idxCliente INNER JOIN
AnagFasi AS af ON ap.idxProgetto = af.idxProgetto INNER JOIN
RegAttivita AS ra ON af.idxFase = ra.idxFase
WHERE (ra.idxDipendente = @idxDipendente OR @idxDipendente = 0)
AND (ra.inizio >= @dataFrom AND ra.inizio <= @dataTo)
AND (ac.idxCliente = @idxCliente OR @idxCliente = 0)
AND (ap.Attivo = CASE WHEN @showPrjArch <> 0 THEN ap.Attivo ELSE 1 END)
GROUP BY ap.idxProgetto
)
SELECT ac.RagSociale
, ap.idxProgetto
, ap.idxCliente
, ap.nomeProj
, ap.descrProj
, ISNULL(ap.budgetTime,0) AS budgetTime
, ISNULL(ap.budgetMoney,0) AS budgetMoney
, ISNULL(ap.OldIdx,-1) AS OldIdx
, ap.Attivo
, ISNULL(ap.codExt,'') AS codExt
, ISNULL(cte.totOre, 0) AS totOre
, ISNULL(ap.avvio,'19000101') AS avvio
, ISNULL(ap.chiusura,'99991231') AS chiusura
FROM AnagClienti AS ac INNER JOIN
AnagProgetti AS ap ON ac.idxCliente = ap.idxCliente LEFT OUTER JOIN
myCte AS cte ON cte.idxProgetto = ap.idxProgetto
WHERE (ac.idxCliente = @idxCliente OR @idxCliente = 0)
AND (ap.Attivo = CASE WHEN @showPrjArch <> 0 THEN ap.Attivo ELSE 1 END)
ORDER BY ac.RagSociale, ap.nomeProj
go
/**********************************************************
* STORED stp_AP_getByIdxCli
*
* recupera elenco progetti da cliente
*
* mod: S.E.L. 2012.10.26
*
**********************************************************/
alter PROCEDURE stp_AP_getByIdxCli
(
@idxCliente INT,
@showPrjArch BIT
)
AS
/*
SELECT *
FROM AnagProgetti
WHERE idxCliente = CASE WHEN @idxCliente > 0 THEN @idxCliente ELSE idxCliente END
AND Attivo = CASE WHEN @showPrjArch <> 0 THEN Attivo ELSE 1 END
ORDER BY nomeProj
*/
;WITH myCTE AS
(
SELECT ap.idxProgetto, SUM(ISNULL(ra.oreTot, 0)) AS totOre
FROM AnagProgetti AS ap INNER JOIN
AnagClienti AS ac ON ac.idxCliente=ap.idxCliente INNER JOIN
AnagFasi AS af ON ap.idxProgetto = af.idxProgetto INNER JOIN
RegAttivita AS ra ON af.idxFase = ra.idxFase
WHERE (ac.idxCliente = @idxCliente OR @idxCliente = 0)
AND (ap.Attivo = CASE WHEN @showPrjArch <> 0 THEN ap.Attivo ELSE 1 END)
GROUP BY ap.idxProgetto
)
SELECT ac.RagSociale
, ap.idxProgetto
, ap.idxCliente
, ap.nomeProj
, ap.descrProj
, ISNULL(ap.budgetTime,0) AS budgetTime
, ISNULL(ap.budgetMoney,0) AS budgetMoney
, ISNULL(ap.OldIdx,-1) AS OldIdx
, ap.Attivo
, ISNULL(ap.codExt,'') AS codExt
, ISNULL(cte.totOre, 0) AS totOre
, ISNULL(ap.avvio,'19000101') AS avvio
, ISNULL(ap.chiusura,'99991231') AS chiusura
FROM AnagClienti AS ac INNER JOIN
AnagProgetti AS ap ON ac.idxCliente = ap.idxCliente LEFT OUTER JOIN
myCte AS cte ON cte.idxProgetto = ap.idxProgetto
WHERE (ac.idxCliente = @idxCliente OR @idxCliente = 0)
AND (ap.Attivo = CASE WHEN @showPrjArch <> 0 THEN ap.Attivo ELSE 1 END)
ORDER BY ac.RagSociale, ap.nomeProj
go
/**********************************************************
* STORED stp_AP_getByIdxPrj
*
* recupera elenco progetti da idx
*
* mod: S.E.L. 2012.11.06
*
**********************************************************/
alter PROCEDURE stp_AP_getByIdxPrj
(
@idxProgetto INT
)
AS
/*
SELECT *
FROM AnagProgetti
WHERE idxProgetto = @idxProgetto
ORDER BY nomeProj
*/
;WITH myCTE AS
(
SELECT ap.idxProgetto, SUM(ISNULL(ra.oreTot, 0)) AS totOre
FROM AnagProgetti AS ap INNER JOIN
AnagClienti AS ac ON ac.idxCliente=ap.idxCliente INNER JOIN
AnagFasi AS af ON ap.idxProgetto = af.idxProgetto INNER JOIN
RegAttivita AS ra ON af.idxFase = ra.idxFase
WHERE ap.idxProgetto = @idxProgetto
GROUP BY ap.idxProgetto
)
SELECT ac.RagSociale
, ap.idxProgetto
, ap.idxCliente
, ap.nomeProj
, ap.descrProj
, ISNULL(ap.budgetTime,0) AS budgetTime
, ISNULL(ap.budgetMoney,0) AS budgetMoney
, ISNULL(ap.OldIdx,-1) AS OldIdx
, ap.Attivo
, ISNULL(ap.codExt,'') AS codExt
, ISNULL(cte.totOre, 0) AS totOre
, ISNULL(ap.avvio,'19000101') AS avvio
, ISNULL(ap.chiusura,'99991231') AS chiusura
FROM AnagClienti AS ac INNER JOIN
AnagProgetti AS ap ON ac.idxCliente = ap.idxCliente INNER JOIN
myCte AS cte ON cte.idxProgetto = ap.idxProgetto
WHERE ap.idxProgetto = @idxProgetto
go
/**********************************************************
* STORED stp_AP_insertQuery
*
* inserisce un progetto in anagrafica
*
* mod: S.E.L. 2013.01.30
*
**********************************************************/
alter PROCEDURE stp_AP_insertQuery
(
@idxCliente int,
@nomeProj nvarchar(50),
@descrProj nvarchar(250),
@budgetTime decimal(19, 4),
@budgetMoney decimal(19, 4),
@avvio DATETIME = '19000101',
@chiusura DATETIME = '99991231'
)
AS
SET NOCOUNT OFF;
INSERT INTO AnagProgetti
(idxCliente, nomeProj, descrProj, budgetTime, budgetMoney, Attivo, avvio, chiusura)
VALUES (@idxCliente,@nomeProj,@descrProj,@budgetTime,@budgetMoney, 1, @avvio, @chiusura);
--SELECT idxProgetto, idxCliente, nomeProj, descrProj, budgetTime, budgetMoney, OldIdx, Attivo FROM AnagProgetti WHERE (idxProgetto = SCOPE_IDENTITY())
DECLARE @idxPrj INT
SELECT @idxPrj = SCOPE_IDENTITY()
EXEC stp_AP_getByIdxPrj @idxPrj
go
/**********************************************************
* STORED stp_AP_update
*
* elimina un progetto da anagrafica
*
* mod: S.E.L. 2013.01.30
*
**********************************************************/
alter PROCEDURE stp_AP_update
(
@idxCliente INT,
@nomeProj NVARCHAR(50),
@descrProj NVARCHAR(250),
@budgetTime DECIMAL(19, 4),
@budgetMoney DECIMAL(19, 4),
@avvio DATETIME = '19000101',
@chiusura DATETIME = '99991231',
@Original_idxProgetto INT
)
AS
SET NOCOUNT OFF;
UPDATE dbo.AnagProgetti
SET idxCliente = @idxCliente,
nomeProj = @nomeProj,
descrProj = @descrProj,
budgetTime = @budgetTime,
budgetMoney = @budgetMoney,
avvio = @avvio,
chiusura = @chiusura
WHERE idxProgetto = @Original_idxProgetto;
/*
SELECT idxProgetto, idxCliente, nomeProj, descrProj, budgetTime, budgetMoney, Attivo
FROM AnagProgetti
WHERE (idxProgetto =@Original_idxProgetto)
*/
EXEC stp_AP_getByIdxPrj @Original_idxProgetto
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_AF_updateFaseAncest
*
* cambia la fase ancestor per una fase e le relative sottofasi dell'albero
*
* mod: S.E.L. 2013.01.31
*
**********************************************************/
create PROCEDURE stp_AF_updateFaseAncest
(
@idxFaseAncest INT,
@Original_idxFase INT
)
AS
SET NOCOUNT OFF;
UPDATE AnagFasi
SET idxFaseAncest = @idxFaseAncest
WHERE idxFase = @Original_idxFase;
SELECT * FROM AnagFasi WHERE idxFase = @Original_idxFase
go
/**********************************************************
* STORED stp_AF_updateProegtto
*
* cambia il progetto per una fase e le relative sottofasi dell'albero
*
* mod: S.E.L. 2013.01.31
*
**********************************************************/
create PROCEDURE stp_AF_updateProgetto
(
@idxProgetto INT,
@Original_idxFase INT
)
AS
SET NOCOUNT OFF;
UPDATE AnagFasi
SET idxProgetto = @idxProgetto
WHERE idxFase = @Original_idxFase;
SELECT * FROM AnagFasi WHERE idxFase = @Original_idxFase
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_RA_clonaLastRA_Utente
*
* clona un attività utente: se c'è da ultima altrimenti da zero x una certa data
*
* mod: S.E.L. 2013.01.17
*
**********************************************************/
alter PROCEDURE stp_RA_clonaLastRA_Utente
(
@idxDipendente INT,
@dataRif DATETIME -- data x cui creare un record attività
)
AS
-- variabili
DECLARE @idxFase INT
DECLARE @idxRA INT
-- arrotondo data richiesta solo all'ora...
SELECT @dataRif = DATEADD(HOUR, DATEPART(HOUR,@dataRif), CONVERT(DATETIME,(CONVERT(DATE,@dataRif))))
-- cerco se esista ultima reg attività utente...
SELECT @idxRA=ISNULL((SELECT TOP 1 idxRA FROM RegAttivita WHERE idxDipendente = @idxDipendente),0)
-- se non ho trovato records, ovvero idxRA = 0, prendo ultima fase da elenco
IF (@idxRA = 0)
BEGIN
-- calcolo ultima fase inserita...
SELECT TOP 1 @idxFase=ISNULL(idxFase,0) FROM AnagFasi ORDER BY idxFase DESC
-- se trovata fase inserisco!
IF(@idxFase > 0)
BEGIN
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (@idxDipendente, @idxFase, @dataRif, DATEADD(HOUR,1,@dataRif), '...',0)
END
END
ELSE
BEGIN
-- inserisco su data richeista duplicazione dell'ultima attività utente...
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione, importo)
SELECT idxDipendente, idxFase, @dataRif, DATEADD(minute, DATEDIFF(MINUTE, inizio, fine), @dataRif), descrizione, importo
FROM RegAttivita
WHERE (idxRA = @idxRA)
END
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(270, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
+714
View File
@@ -0,0 +1,714 @@
alter table AnagKeyValue add
descrizione nvarchar(250);
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/*----------------------------------
* Trigger su insert/update/delete
*
* Aggiorna giustificativi nella tab TimbratureExpl
*
* creato da: S.E. Locatelli - 2012.12.04
* ultima modifica:
*----------------------------------*/
alter TRIGGER trg_giustUpdateTimbr
ON Giustificativi
FOR INSERT, UPDATE
AS
-- controllo se rescord esista altrimenti lo creo!!!
DECLARE @trovate INT = 0
DECLARE @idxDipendente INT
DECLARE @dataRif DATETIME
SET @trovate = ISNULL( ( SELECT COUNT(*) FROM TimbratureExpl te INNER JOIN inserted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav) ,0)
IF(@trovate = 0)
BEGIN
SELECT @idxDipendente = idxDipendente, @dataRif=dataLav FROM inserted
EXEC stp_ricalcolaTimbratureExpl @idxDipendente, @dataRif
END
-- CONTROLLO SE IL RECORD NON SIA BLOCCATO!!!
DECLARE @block BIT
SET @block = ( SELECT te.block FROM TimbratureExpl te INNER JOIN deleted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav )
IF(@block = 0)
BEGIN
-- prendo tutte le "vecchie" righe (deleted) e x le giornate relative TOLGO i minuti dei giustificativi
UPDATE TimbratureExpl
SET minMal = CASE WHEN g.codGiust='MAL' THEN 0 ELSE minMal END,
minFer = CASE WHEN g.codGiust='FER' THEN 0 ELSE minFer END,
minFest = CASE WHEN g.codGiust='FEST' THEN 0 ELSE minFest END,
minPerm = CASE WHEN g.codGiust='PERM' THEN 0 ELSE minPerm END
FROM TimbratureExpl te INNER JOIN deleted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav
END
SET @block = ( SELECT te.block FROM TimbratureExpl te INNER JOIN inserted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav )
IF(@block = 0)
BEGIN
-- prendo le "nuove" righe (inserted) e x le giornate relative AGGIUNGO i minuti dei giustificativi
UPDATE TimbratureExpl
SET minMal = CASE WHEN g.codGiust='MAL' THEN g.minuti ELSE minMal END,
minFer = CASE WHEN g.codGiust='FER' THEN g.minuti ELSE minFer END,
minFest = CASE WHEN g.codGiust='FEST' THEN g.minuti ELSE minFest END,
minPerm = CASE WHEN g.codGiust='PERM' THEN g.minuti ELSE minPerm END
FROM TimbratureExpl te INNER JOIN inserted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav
END
go
/*----------------------------------
* Trigger su insert/update/delete
*
* Aggiorna giustificativi nella tab TimbratureExpl
*
* creato da: S.E. Locatelli - 2012.12.04
* ultima modifica:
*----------------------------------*/
create TRIGGER trg_giustDelUpdTimbr
ON Giustificativi
FOR DELETE
AS
-- controllo se rescord esista altrimenti lo creo!!!
DECLARE @trovate INT = 0
DECLARE @idxDipendente INT
DECLARE @dataRif DATETIME
-- CONTROLLO SE IL RECORD NON SIA BLOCCATO!!!
DECLARE @block BIT
SET @block = ( SELECT te.block FROM TimbratureExpl te INNER JOIN deleted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav )
IF(@block = 0)
BEGIN
-- prendo tutte le "vecchie" righe (deleted) e x le giornate relative TOLGO i minuti dei giustificativi
UPDATE TimbratureExpl
SET minMal = CASE WHEN g.codGiust='MAL' THEN 0 ELSE minMal END,
minFer = CASE WHEN g.codGiust='FER' THEN 0 ELSE minFer END,
minFest = CASE WHEN g.codGiust='FEST' THEN 0 ELSE minFest END,
minPerm = CASE WHEN g.codGiust='PERM' THEN 0 ELSE minPerm END
FROM TimbratureExpl te INNER JOIN deleted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav
END
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
alter VIEW v_selFasi
AS
SELECT idxFase AS value, nomeFase AS label, idxProgetto AS conditio, enableTime, codFase, idxFase * enableTime AS valueGroup
FROM dbo.AnagFasi
go
exec sp_updateextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "AnagFasi"
Begin Extent =
Top = 6
Left = 38
Bottom = 284
Right = 209
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 1500
Width = 11985
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_selFasi';
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
alter VIEW v_selProgetti
AS
SELECT dbo.AnagProgetti.idxProgetto AS value, dbo.AnagClienti.RagSociale + ' - ' + dbo.AnagProgetti.nomeProj AS label, dbo.AnagClienti.idxCliente AS conditio,
dbo.AnagProgetti.Attivo
FROM dbo.AnagClienti INNER JOIN
dbo.AnagProgetti ON dbo.AnagClienti.idxCliente = dbo.AnagProgetti.idxCliente
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_AF_getByIdxProj
*
* elenco fasi da progetto
*
* mod: S.E.L. 2012.10.31
*
**********************************************************/
alter PROCEDURE stp_AF_getByIdxProj
(
@idxProgetto INT
)
AS
SET NOCOUNT ON;
/*
SELECT idxFase, idxProgetto, codFase, idxFaseAncest, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo, codClasse, codExt
FROM AnagFasi
WHERE (idxProgetto = @idxProgetto)
ORDER BY codFase
*/
-- dichiaro variabili "accessorie"
DECLARE @idxDipendente INT = 0 -- 0 = tutti
DECLARE @dataFrom DATETIME = '19000101'
DECLARE @dataTo DATETIME = '99991231'
-- controllo se date nulle importo a min/max
DECLARE @firstDate DATETIME
DECLARE @lastDate DATETIME
SELECT @firstDate = MIN(inizio), @lastDate=DATEADD(DAY,1,MAX(inizio)) FROM RegAttivita
SELECT @dataFrom = ISNULL(@dataFrom, @firstDate), @dataTo=ISNULL(@dataTo, @lastDate)
;WITH myCTE AS
(
SELECT af.idxFase, SUM(ISNULL(ra.oreTot, 0)) AS totOre
FROM AnagFasi AS af INNER JOIN
RegAttivita AS ra ON af.idxFase = ra.idxFase
WHERE (ra.idxDipendente = @idxDipendente OR @idxDipendente = 0)
AND (ra.inizio >= @dataFrom AND ra.inizio <= @dataTo)
AND (af.idxProgetto = @idxProgetto OR @idxProgetto = 0)
GROUP BY af.idxFase
)
SELECT af.idxFase
, af.idxProgetto
, af.codFase
, af.idxFaseAncest
, af.nomeFase
, af.descrizioneFase
, af.enableTime
, af.enableMoney
, af.Attivo
, ISNULL(af.budgetTime,0) AS budgetTime
, ISNULL(af.budgetMoney,0) AS budgetMoney
, ISNULL(af.codClasse,'') AS codClasse
, ISNULL(af.codExt, '') AS codExt
, ISNULL(cte.totOre, 0) AS totOre
FROM AnagFasi AS af LEFT OUTER JOIN
myCte AS cte ON cte.idxFase = af.idxFase
WHERE (af.idxProgetto = @idxProgetto OR @idxProgetto = 0)
ORDER BY af.codFase, af.nomeFase
go
/**********************************************************
* STORED stp_AF_InsertQuery
*
* elenco fasi da progetto
*
* mod: S.E.L. 2012.11.02
*
**********************************************************/
alter PROCEDURE stp_AF_InsertQuery
(
@idxProgetto INT,
@idxFaseAncest INT,
@nomeFase NVARCHAR(50),
@descrizioneFase NVARCHAR(250),
@enableTime BIT,
@enableMoney BIT,
@budgetTime decimal(19, 4),
@budgetMoney decimal(19, 4),
@Attivo BIT
)
AS
SET NOCOUNT OFF;
INSERT INTO AnagFasi ( codFase, idxProgetto, idxFaseAncest, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo, budgetTime, budgetMoney)
VALUES ('', @idxProgetto, @idxFaseAncest, @nomeFase, @descrizioneFase, @enableTime, @enableMoney, @Attivo, @budgetTime, @budgetMoney);
SELECT idxFase, idxProgetto, codFase, idxFaseAncest, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo FROM AnagFasi WHERE (idxFase = SCOPE_IDENTITY())
go
/**********************************************************
* STORED stp_AF_getByIdxProj
*
* elenco fasi da progetto
*
* mod: S.E.L. 2012.11.02
*
**********************************************************/
alter PROCEDURE stp_AF_updateQuery
(
@nomeFase nvarchar(50),
@descrizioneFase nvarchar(250),
@enableTime bit,
@enableMoney bit,
@Attivo int,
@budgetTime DECIMAL(19, 4),
@budgetMoney DECIMAL(19, 4),
@Original_idxFase int
)
AS
SET NOCOUNT OFF;
UPDATE AnagFasi
SET nomeFase = @nomeFase,
descrizioneFase = @descrizioneFase,
enableTime = @enableTime,
enableMoney = @enableMoney,
budgetTime = @budgetTime,
budgetMoney = @budgetMoney,
Attivo = @Attivo
WHERE idxFase = @Original_idxFase;
SELECT * FROM AnagFasi WHERE idxFase = @Original_idxFase
go
/*----------------------------------
* STORED PROCEDURE stp_giust_insByDate
*
* Aggiunge un giustificativo per coprire la durata necessaria a chiudere la giornata indicata
* mod: S.E.L. - 2012.12.10
*----------------------------------*/
alter PROCEDURE stp_giust_insByDate
(
@idxDipendente INT = 0,
@dataRif DATETIME,
@codGiust NVARCHAR(5) = 'PERM'
)
AS
BEGIN TRAN
--min necessari x chiudere giornata
DECLARE @minPerm INT = 0
-- variabili
DECLARE @minArr INT
--SELECT @minArr=dbo.f_minArrotDip(@idxDipendente)
SELECT @minArr = ISNULL(valInt,1) FROM AnagKeyValue WHERE nomeVar = 'minutiRoundDay'
-- calcolo minuti
SELECT @minPerm = (CEILING(CONVERT(FLOAT,minOrd-minLav)/@minArr)*@minArr)
FROM TimbratureExpl
WHERE isOkLav = 0
AND idxDipendente = @idxDipendente
AND dataLav = @dataRif
-- INSERT giustificativo!
INSERT INTO Giustificativi
VALUES (@dataRif,@idxDipendente,@codGiust,@minPerm,1)
COMMIT TRAN
RETURN
go
/**********************************************************
* STORED stp_RAD_Expl_getByIdxDipData
*
* recupera elenco attività (con Expl dei dati da anagrafica) da idxDipendente + dataRif
*
* mod: S.E.L. 2013.01.23
*
**********************************************************/
alter PROCEDURE stp_RAD_Expl_getByIdxDipData
(
@idxDipendente INT,
@dataRif DATETIME
)
AS
SELECT d.Cognome + ' ' + d.Nome AS CognomeNome, ra.idxDipendente, ra.inizio, ra.fine
, CASE WHEN ISNULL(descrizione, '') = '' THEN '-' ELSE ISNULL(descrizione, '') END AS descrizione
, ra.oreTot, ra.oreTot * 60 AS minTot, ra.importo, ac.RagSociale, ap.nomeProj, af.nomeFase, ra.idxRA
FROM RegAttivita ra INNER JOIN
AnagFasi af ON ra.idxFase = af.idxFase INNER JOIN
AnagProgetti ap ON af.idxProgetto = ap.idxProgetto INNER JOIN
AnagClienti ac ON ap.idxCliente = ac.idxCliente INNER JOIN
Dipendenti d ON ra.idxDipendente = d.idxDipendente
WHERE (ra.idxDipendente = @idxDipendente OR @idxDipendente = 0) AND (CAST(ra.inizio AS DATE) = CAST(@dataRif AS DATE) OR
CAST(ra.fine AS DATE) = CAST(@dataRif AS DATE))
ORDER BY ra.inizio
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_ReportOreDip
*
* elenco ore dipendenti
*
* mod: S.E.L. 2013.02.04
*
**********************************************************/
create PROCEDURE export.stp_ReportOreDip
(
@idxDipendente INT = 0, -- 0 = tutti
@dataFrom DATETIME,
@dataTo DATETIME
)
AS
SET NOCOUNT OFF;
DECLARE @minArr INT
SELECT @minArr = ISNULL(valInt,1) FROM AnagKeyValue WHERE nomeVar = 'minutiRoundDay'
-- elenco mensile...
SELECT dataLav, CognomeNome,
entrata_1, uscita_1, entrata_2, uscita_2,
entrata_3, uscita_3, entrata_4, uscita_4,
FLOOR(CAST(h_lav AS DECIMAL(9,3))*60/@minArr)/(60/@minArr) AS h_lavorate,
FLOOR(CAST(minStra AS DECIMAL(9,3))/@minArr)/(60/@minArr) AS h_straordinarie,
CEILING(CAST(minPerm AS DECIMAL(9,3))/@minArr)/(60/@minArr) AS h_permessi,
CEILING(CAST(minFer AS DECIMAL(9,3))/@minArr)/(60/@minArr) AS h_ferie,
CEILING(CAST(minMal AS DECIMAL(9,3))/@minArr)/(60/@minArr) AS h_malattia,
CEILING(CAST(minFest AS DECIMAL(9,3))/@minArr)/(60/@minArr) AS h_festivita
FROM TimbratureExpl
WHERE (idxDipendente = @idxDipendente OR @idxDipendente = 0)
AND dataLav >= CAST(@dataFrom AS DATE)
AND dataLav <= CAST(@dataTo AS DATE)
ORDER BY CognomeNome, dataLav
go
/**********************************************************
* STORED stp_RAD_Expl_getByIdxDipPeriodo
*
* recupera elenco attività (con Expl dei dati da anagrafica) da idxDipendente + periodo + opzionali cliente e progetto
*
* mod: S.E.L. 2013.02.01
*
**********************************************************/
create PROCEDURE stp_RAD_Expl_getByIdxDipPeriodo
(
@idxDipendente INT,
@dataFrom DATETIME,
@dataTo DATETIME,
@idxCliente INT = 0, -- 0 = tutti
@idxProgetto INT = 0, -- 0 = tutti
@soloAncest BIT = 0 -- 0 = tutti
)
AS
SELECT d.Cognome + ' ' + d.Nome AS CognomeNome, ra.idxDipendente, ra.inizio, ra.fine
, CASE WHEN ISNULL(descrizione, '') = '' THEN '-' ELSE ISNULL(descrizione, '') END AS descrizione
, ra.oreTot, ra.oreTot * 60 AS minTot, ra.importo, ac.RagSociale, ap.nomeProj,
af.nomeFase, ra.idxRA
FROM RegAttivita ra INNER JOIN
AnagFasi af ON ra.idxFase = af.idxFase INNER JOIN
AnagProgetti ap ON af.idxProgetto = ap.idxProgetto INNER JOIN
AnagClienti ac ON ap.idxCliente = ac.idxCliente INNER JOIN
Dipendenti d ON ra.idxDipendente = d.idxDipendente
WHERE (ra.idxDipendente = @idxDipendente OR @idxDipendente=0)
AND (ra.inizio >= CAST(@dataFrom AS DATE) AND ra.inizio <= CAST(@dataTo AS DATE))
AND (ac.idxCliente = @idxCliente OR @idxCliente <= 0)
AND (ap.idxProgetto = @idxProgetto OR @idxProgetto <= 0)
AND (af.idxFaseAncest = CASE WHEN @soloAncest <> 0 THEN 0 ELSE af.idxFaseAncest END )
ORDER BY ra.inizio
go
/**********************************************************
* STORED stp_RA_updateFase
*
* update fase x record selezionato
*
* mod: S.E.L. 2013.02.01
*
**********************************************************/
create PROCEDURE stp_RA_updateFase
(
@idxFase int,
@Original_idxRA int
)
AS
SET NOCOUNT OFF;
UPDATE RegAttivita
SET idxFase = @idxFase
WHERE (idxRA = @Original_idxRA);
go
/*************************************
* STORED PROCEDURE stp_VSFasiOpt_ByPrj
*
* elenco fasi dato progetto con calmpo valore a zero se fase "ancestor"
*
* mod : 2013.02.01
* aut : S.E. Locatelli
**************************************/
create PROCEDURE stp_VSFasiOpt_ByPrj
(
@conditio INT = 0
,@soloAttivi BIT = 0 -- 0 = tutti, 1 = solo attivi x time tracking
)
AS
SELECT value as valueGroup, label, conditio, valueGroup as value
FROM v_selFasi
WHERE conditio = @conditio
AND (enableTime = @soloAttivi OR @soloAttivi = 0)
ORDER BY codFase, label
RETURN
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/*************************************
* STORED PROCEDURE stp_VSFasi_ByPrj
*
* elenco fasi dato progetto
*
* mod : 26/09/2012
* aut : S.E. Locatelli
**************************************/
alter PROCEDURE stp_VSFasi_ByPrj
(
@conditio INT = 0
,@soloAttivi BIT = 0 -- 0 = tutti, 1 = solo attivi x time tracking
)
AS
SELECT value, label, conditio
FROM v_selFasi
WHERE conditio = @conditio
AND (enableTime = @soloAttivi OR @soloAttivi = 0)
ORDER BY codFase, label
RETURN
go
/*************************************
* STORED PROCEDURE stp_VSPrj
*
* elenco progetti "formattato" by cliente
*
* mod : 26/09/2012
* aut : S.E. Locatelli
**************************************/
alter PROCEDURE stp_VSPrj
(
@soloAttivi BIT = 0 -- 0 = tutti, 1 = solo attivi
)
AS
/*
WITH myCTE AS
(
SELECT MIN(value) as value, conditio AS label, conditio
FROM v_selProgetti
GROUP BY conditio
UNION
SELECT *
FROM v_selProgetti
)
SELECT *
FROM myCTE
ORDER BY conditio, label
*/
SELECT *
FROM v_selProgetti
WHERE (Attivo = @soloAttivi OR @soloAttivi = 0)
ORDER BY label
RETURN
go
/*************************************
* STORED PROCEDURE stp_VSPrj
*
* elenco progetti "formattato" by cliente
*
* mod : 26/09/2012
* aut : S.E. Locatelli
**************************************/
alter PROCEDURE stp_VSPrj_byConditio
(
@conditio NVARCHAR(50)
,@soloAttivi BIT = 0 -- 0 = tutti, 1 = solo attivi
)
AS
SET NOCOUNT ON;
SELECT value, label, conditio, Attivo
FROM v_selProgetti
WHERE (conditio = @conditio OR @conditio=0)
AND (Attivo = @soloAttivi OR @soloAttivi = 0)
ORDER BY label
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(290, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
@@ -0,0 +1,181 @@
set xact_abort on
go
begin transaction
go
set identity_insert dbo.AnagFasi on
go
INSERT INTO dbo.AnagFasi
(idxFase, idxProgetto, codFase, idxFaseAncest, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo, codClasse, codExt, budgetTime, budgetMoney)
VALUES (74, 5, N'F.5.74.', 5, N'prodotto3D', N'prodotto3D', 1, 0, 1, NULL, NULL, NULL, NULL)
INSERT INTO dbo.AnagFasi
(idxFase, idxProgetto, codFase, idxFaseAncest, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo, codClasse, codExt, budgetTime, budgetMoney)
VALUES (75, 6, N'F.8.75.', 8, N'attrezzature2D', N'attrezzature2D', 1, 0, 1, NULL, NULL, NULL, NULL)
INSERT INTO dbo.AnagFasi
(idxFase, idxProgetto, codFase, idxFaseAncest, nomeFase, descrizioneFase, enableTime, enableMoney, Attivo, codClasse, codExt, budgetTime, budgetMoney)
VALUES (76, 8, N'F.15.76.', 15, N'attrezzature3D', N'attrezzature3D', 1, 0, 1, NULL, NULL, NULL, NULL)
go
set identity_insert dbo.AnagFasi off
go
commit transaction
go
set xact_abort on
go
begin transaction
go
set identity_insert dbo.RegAttivita on
go
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (319, 11, 56, '2013-01-04 08:00:00.000', '2013-01-04 12:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (320, 2, 57, '2013-01-08 08:00:00.000', '2013-01-08 09:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (321, 2, 57, '2013-01-09 08:00:00.000', '2013-01-09 16:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (322, 2, 57, '2013-01-10 08:00:00.000', '2013-01-10 16:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (323, 2, 57, '2013-01-11 08:00:00.000', '2013-01-11 16:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (324, 2, 57, '2013-01-14 08:00:00.000', '2013-01-14 16:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (325, 2, 57, '2013-01-15 08:00:00.000', '2013-01-15 16:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (326, 2, 57, '2013-01-16 08:00:00.000', '2013-01-16 14:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (327, 2, 57, '2013-01-21 08:00:00.000', '2013-01-21 11:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (328, 2, 57, '2013-01-25 08:00:00.000', '2013-01-25 12:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (329, 2, 57, '2013-01-28 08:00:00.000', '2013-01-28 16:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (330, 2, 57, '2013-01-29 08:00:00.000', '2013-01-29 16:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (331, 2, 57, '2013-01-30 08:00:00.000', '2013-01-30 16:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (332, 2, 57, '2013-01-31 08:00:00.000', '2013-01-31 16:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (333, 3, 63, '2013-01-11 10:00:00.000', '2013-01-11 11:00:00.000', N'sistemazione br222 sx deckel', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (334, 7, 64, '2013-02-01 08:00:00.000', '2013-02-01 11:00:00.000', N'br222 sx 2d', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (335, 3, 65, '2013-01-11 08:00:00.000', '2013-01-11 09:00:00.000', N'sistemazione coltello ford cd4 sx', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (336, 3, 65, '2013-01-30 08:00:00.000', '2013-01-30 10:00:00.000', N'modifica br 222 sx sede', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (337, 7, 65, '2013-01-07 08:00:00.000', '2013-01-07 12:00:00.000', N'modifiche gm epsilon', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (338, 7, 65, '2013-01-11 08:00:00.000', '2013-01-11 13:00:00.000', N'modifica br222', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (339, 7, 65, '2013-01-30 08:00:00.000', '2013-01-30 13:00:00.000', N'modifiche 3d + 2d', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (340, 7, 65, '2013-01-31 08:00:00.000', '2013-01-31 12:00:00.000', N'br222 sx modifiche', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (341, 3, 66, '2013-01-17 08:00:00.000', '2013-01-17 10:00:00.000', N'controllo modifica br222 sx 2 impr.', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (342, 6, 68, '2013-01-31 08:00:00.000', '2013-01-31 17:00:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (343, 6, 68, '2013-02-01 08:00:00.000', '2013-02-01 16:30:00.000', N'', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (344, 3, 76, '2013-01-28 08:00:00.000', '2013-01-28 17:00:00.000', N'SISTEMAZIONE MOV. N°13 HONDA DESTRA', 0.0000)
INSERT INTO dbo.RegAttivita
(idxRA, idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (345, 3, 76, '2013-01-29 08:00:00.000', '2013-01-29 15:00:00.000', N' MODIFICA HONDA DESTRA', 0.0000)
go
set identity_insert dbo.RegAttivita off
go
commit transaction
go
set xact_abort on
go
begin transaction
go
UPDATE dbo.Permessi SET
NUMERO=4
WHERE COD_PERMESSO='ADMIN_dipendenti'
UPDATE dbo.Permessi SET
NUMERO=5
WHERE COD_PERMESSO='ADMIN_orario'
INSERT INTO dbo.Permessi
VALUES ('ADMIN_spostaFasi', 'spostaFasi.aspx', 1, 3, 'SpostaFasi', 'SpostaFasiExpl')
INSERT INTO dbo.Permessi
VALUES ('MANAGE_Report', 'reportProgetti.aspx', 2, 4, 'ReportPrj', 'ReportPrjExpl')
go
commit transaction
go
set xact_abort on
go
begin transaction
go
INSERT INTO dbo.Permessi2Funzione
VALUES ('ADMIN', N'GPW_prjAdm', 'S')
INSERT INTO dbo.Permessi2Funzione
VALUES ('ADMIN_clienti', N'GPW_prjAdm', 'S')
INSERT INTO dbo.Permessi2Funzione
VALUES ('ADMIN_fasi', N'GPW_prjAdm', 'S')
INSERT INTO dbo.Permessi2Funzione
VALUES ('ADMIN_progetti', N'GPW_prjAdm', 'S')
INSERT INTO dbo.Permessi2Funzione
VALUES ('ADMIN_spostaFasi', N'GPW_admin', NULL)
INSERT INTO dbo.Permessi2Funzione
VALUES ('ADMIN_spostaFasi', N'GPW_prjAdm', NULL)
INSERT INTO dbo.Permessi2Funzione
VALUES ('MANAGE', N'GPW_prjAdm', 'S')
INSERT INTO dbo.Permessi2Funzione
VALUES ('MANAGE_Report', N'GPW_admin', NULL)
INSERT INTO dbo.Permessi2Funzione
VALUES ('MANAGE_Report', N'GPW_prjAdm', NULL)
go
commit transaction
go
--- forzo ricalcolo attività expl!
EXEC stp_ricalcolaRegAttivitaExpl_byPeriodoUser 0, '20120101', '20130204'
+668
View File
@@ -0,0 +1,668 @@
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
-- =============================================
-- Author: S.E. Locatelli
-- Create date: 2013.02.13
-- Description: Gestione trigger update attivo x sottofasi
-- =============================================
create TRIGGER trg_AF_updateAttivoSubFasi
ON AnagFasi
AFTER UPDATE
AS
BEGIN
IF (@@ROWCOUNT = 0) -- SE NESSUNA RIGA AGGIORNATA O INSERITA ESCO
RETURN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- CONTROLLO se è stato aggiornato "attivo)
IF(UPDATE(Attivo))
BEGIN
-- lo farò solo sulle sottofasi e x i casi di modifica di fasi "master"...
UPDATE AF
SET AF.Attivo = i.Attivo
FROM AnagFasi AF
INNER JOIN inserted i ON AF.idxFaseAncest = i.idxFase
INNER JOIN deleted d ON i.idxFase = d.idxFase
WHERE i.Attivo <> d.Attivo
END
END
go
commit;
go
alter table AnagProgetti drop
column budgetTime,
column budgetMoney;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
alter VIEW v_selFasi
AS
SELECT idxFase AS value, nomeFase AS label, idxProgetto AS conditio, enableTime, codFase, idxFase * enableTime AS valueGroup, Attivo
FROM dbo.AnagFasi
go
exec sp_updateextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "AnagFasi"
Begin Extent =
Top = 6
Left = 38
Bottom = 284
Right = 209
End
DisplayFlags = 280
TopColumn = 1
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 1500
Width = 11985
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_selFasi';
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_AP_Expl_getData
*
* recupera elenco progetti con filtraggio ore totali per
* - dipendente
* - periodo
*
* mod: S.E.L. 2013.01.30
*
**********************************************************/
alter PROCEDURE stp_AP_Expl_getData
(
@idxDipendente INT = 0, -- 0 = tutti
@dataFrom DATETIME = '19000101',
@dataTo DATETIME = '99991231',
@idxCliente INT = 0, -- 0 = tutti
@showPrjArch BIT = 1 -- 1 = mostra tutti
)
AS
-- controllo se date nulle importo a min/max
DECLARE @firstDate DATETIME
DECLARE @lastDate DATETIME
SELECT @firstDate = MIN(inizio), @lastDate=DATEADD(DAY,1,MAX(inizio)) FROM RegAttivita
SELECT @dataFrom=ISNULL(@dataFrom, @firstDate) , @dataTo=ISNULL(@dataTo, @lastDate)
;WITH cteOreReal AS
(
SELECT ap.idxProgetto, SUM(ISNULL(ra.oreTot, 0)) AS totOre
FROM AnagProgetti AS ap INNER JOIN
AnagClienti AS ac ON ac.idxCliente=ap.idxCliente INNER JOIN
AnagFasi AS af ON ap.idxProgetto = af.idxProgetto INNER JOIN
RegAttivita AS ra ON af.idxFase = ra.idxFase
WHERE (ra.idxDipendente = @idxDipendente OR @idxDipendente = 0)
AND (ra.inizio >= @dataFrom AND ra.inizio <= @dataTo)
AND (ac.idxCliente = @idxCliente OR @idxCliente = 0)
AND (ap.Attivo = CASE WHEN @showPrjArch <> 0 THEN ap.Attivo ELSE 1 END)
GROUP BY ap.idxProgetto
)
,cteOreBudget as
(
SELECT
idxProgetto
,SUM(ISNULL(budgetTime,0)) as budgetTime
,SUM(ISNULL(budgetMoney,0)) as budgetMoney
FROM AnagFasi
GROUP BY idxProgetto
)
SELECT ac.RagSociale
, ap.idxProgetto
, ap.idxCliente
, ap.nomeProj
, ap.descrProj
, ISNULL(bdgt.budgetTime,0) AS budgetTime
, ISNULL(bdgt.budgetMoney,0) AS budgetMoney
, ISNULL(ap.OldIdx,-1) AS OldIdx
, ap.Attivo
, ISNULL(ap.codExt,'') AS codExt
, ISNULL(cte.totOre, 0) AS totOre
, ISNULL(ap.avvio,'19000101') AS avvio
, ISNULL(ap.chiusura,'99991231') AS chiusura
FROM AnagClienti AS ac INNER JOIN
AnagProgetti AS ap ON ac.idxCliente = ap.idxCliente LEFT OUTER JOIN
cteOreBudget AS bdgt ON ap.idxProgetto = bdgt.idxProgetto LEFT OUTER JOIN
cteOreReal AS cte ON cte.idxProgetto = ap.idxProgetto
WHERE (ac.idxCliente = @idxCliente OR @idxCliente = 0)
AND (ap.Attivo = CASE WHEN @showPrjArch <> 0 THEN ap.Attivo ELSE 1 END)
ORDER BY ac.RagSociale, ap.nomeProj
go
/**********************************************************
* STORED stp_AP_getByIdxCli
*
* recupera elenco progetti da cliente
*
* mod: S.E.L. 2012.10.26
*
**********************************************************/
alter PROCEDURE stp_AP_getByIdxCli
(
@idxCliente INT,
@showPrjArch BIT
)
AS
;WITH cteOreReal AS
(
SELECT ap.idxProgetto, SUM(ISNULL(ra.oreTot, 0)) AS totOre
FROM AnagProgetti AS ap INNER JOIN
AnagClienti AS ac ON ac.idxCliente=ap.idxCliente INNER JOIN
AnagFasi AS af ON ap.idxProgetto = af.idxProgetto INNER JOIN
RegAttivita AS ra ON af.idxFase = ra.idxFase
WHERE (ac.idxCliente = @idxCliente OR @idxCliente = 0)
AND (ap.Attivo = CASE WHEN @showPrjArch <> 0 THEN ap.Attivo ELSE 1 END)
GROUP BY ap.idxProgetto
)
,cteOreBudget as
(
select
idxProgetto
,SUM(ISNULL(budgetTime,0)) as budgetTime
,SUM(ISNULL(budgetMoney,0)) as budgetMoney
from AnagFasi
GROUP BY idxProgetto
)
SELECT ac.RagSociale
, ap.idxProgetto
, ap.idxCliente
, ap.nomeProj
, ap.descrProj
, ISNULL(bdgt.budgetTime,0) AS budgetTime
, ISNULL(bdgt.budgetMoney,0) AS budgetMoney
, ISNULL(ap.OldIdx,-1) AS OldIdx
, ap.Attivo
, ISNULL(ap.codExt,'') AS codExt
, ISNULL(cte.totOre, 0) AS totOre
, ISNULL(ap.avvio,'19000101') AS avvio
, ISNULL(ap.chiusura,'99991231') AS chiusura
FROM AnagClienti AS ac INNER JOIN
AnagProgetti AS ap ON ac.idxCliente = ap.idxCliente LEFT OUTER JOIN
cteOreBudget AS bdgt ON ap.idxProgetto = bdgt.idxProgetto LEFT OUTER JOIN
cteOreReal AS cte ON cte.idxProgetto = ap.idxProgetto
WHERE (ac.idxCliente = @idxCliente OR @idxCliente = 0)
AND (ap.Attivo = CASE WHEN @showPrjArch <> 0 THEN ap.Attivo ELSE 1 END)
ORDER BY ac.RagSociale, ap.nomeProj
go
/**********************************************************
* STORED stp_AP_getByIdxPrj
*
* recupera elenco progetti da idx
*
* mod: S.E.L. 2012.11.06
*
**********************************************************/
alter PROCEDURE stp_AP_getByIdxPrj
(
@idxProgetto INT
)
AS
/*
SELECT *
FROM AnagProgetti
WHERE idxProgetto = @idxProgetto
ORDER BY nomeProj
*/
;WITH cteOreReal AS
(
SELECT ap.idxProgetto, SUM(ISNULL(ra.oreTot, 0)) AS totOre
FROM AnagProgetti AS ap INNER JOIN
AnagClienti AS ac ON ac.idxCliente=ap.idxCliente INNER JOIN
AnagFasi AS af ON ap.idxProgetto = af.idxProgetto INNER JOIN
RegAttivita AS ra ON af.idxFase = ra.idxFase
WHERE ap.idxProgetto = @idxProgetto
GROUP BY ap.idxProgetto
)
,cteOreBudget as
(
select
idxProgetto
,SUM(ISNULL(budgetTime,0)) as budgetTime
,SUM(ISNULL(budgetMoney,0)) as budgetMoney
from AnagFasi
GROUP BY idxProgetto
)
SELECT ac.RagSociale
, ap.idxProgetto
, ap.idxCliente
, ap.nomeProj
, ap.descrProj
, ISNULL(bdgt.budgetTime,0) AS budgetTime
, ISNULL(bdgt.budgetMoney,0) AS budgetMoney
, ISNULL(ap.OldIdx,-1) AS OldIdx
, ap.Attivo
, ISNULL(ap.codExt,'') AS codExt
, ISNULL(cte.totOre, 0) AS totOre
, ISNULL(ap.avvio,'19000101') AS avvio
, ISNULL(ap.chiusura,'99991231') AS chiusura
FROM AnagClienti AS ac INNER JOIN
AnagProgetti AS ap ON ac.idxCliente = ap.idxCliente LEFT OUTER JOIN
cteOreBudget AS bdgt ON ap.idxProgetto = bdgt.idxProgetto LEFT OUTER JOIN
cteOreReal AS cte ON cte.idxProgetto = ap.idxProgetto
WHERE ap.idxProgetto = @idxProgetto
go
/**********************************************************
* STORED stp_AP_insertQuery
*
* inserisce un progetto in anagrafica
*
* mod: S.E.L. 2013.01.30
*
**********************************************************/
alter PROCEDURE stp_AP_insertQuery
(
@idxCliente int,
@nomeProj nvarchar(50),
@descrProj nvarchar(250)
)
AS
SET NOCOUNT OFF;
DECLARE @avvio DATETIME = '19000101'
DECLARE @chiusura DATETIME = '99991231'
INSERT INTO AnagProgetti
(idxCliente, nomeProj, descrProj, Attivo, avvio, chiusura)
VALUES (@idxCliente,@nomeProj,@descrProj, 1, @avvio, @chiusura);
/*
DECLARE @idxPrj INT
SELECT @idxPrj = SCOPE_IDENTITY()
EXEC stp_AP_getByIdxPrj @idxPrj
*/
go
/**********************************************************
* STORED stp_AP_update
*
* elimina un progetto da anagrafica
*
* mod: S.E.L. 2013.01.30
*
**********************************************************/
alter PROCEDURE stp_AP_update
(
@idxCliente INT,
@nomeProj NVARCHAR(50),
@descrProj NVARCHAR(250),
--@avvio DATETIME = '19000101',
--@chiusura DATETIME = '99991231',
@Original_idxProgetto INT
)
AS
SET NOCOUNT OFF;
UPDATE dbo.AnagProgetti
SET idxCliente = @idxCliente
,nomeProj = @nomeProj
,descrProj = @descrProj
--,avvio = @avvio,
--,chiusura = @chiusura
WHERE idxProgetto = @Original_idxProgetto;
/*
EXEC stp_AP_getByIdxPrj @Original_idxProgetto
*/
go
/**********************************************************
* STORED stp_AP_updateAttivo
*
* elimina un progetto da anagrafica
*
* mod: S.E.L. 2012.11.06
*
**********************************************************/
alter PROCEDURE stp_AP_updateAttivo
(
@Attivo BIT,
@Original_idxProgetto INT
)
AS
SET NOCOUNT OFF;
UPDATE dbo.AnagProgetti
SET Attivo = @Attivo
WHERE idxProgetto = @Original_idxProgetto;
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_RAD_Expl_getByIdxDipPeriodo
*
* recupera elenco attività (con Expl dei dati da anagrafica) da idxDipendente + periodo + opzionali cliente e progetto
*
* mod: S.E.L. 2013.02.01
*
**********************************************************/
alter PROCEDURE stp_RAD_Expl_getByIdxDipPeriodo
(
@idxDipendente INT,
@dataFrom DATETIME,
@dataTo DATETIME,
@idxCliente INT = 0, -- 0 = tutti
@idxProgetto INT = 0, -- 0 = tutti
@idxFase INT = 0, -- 0 = tutti
@soloAncest BIT = 0 -- 0 = tutti
)
AS
SELECT d.Cognome + ' ' + d.Nome AS CognomeNome, ra.idxDipendente, ra.inizio, ra.fine
, CASE WHEN ISNULL(descrizione, '') = '' THEN '-' ELSE ISNULL(descrizione, '') END AS descrizione
, ra.oreTot, ra.oreTot * 60 AS minTot, ra.importo, ac.RagSociale, ap.nomeProj,
af.nomeFase, ra.idxRA
FROM RegAttivita ra INNER JOIN
AnagFasi af ON ra.idxFase = af.idxFase INNER JOIN
AnagProgetti ap ON af.idxProgetto = ap.idxProgetto INNER JOIN
AnagClienti ac ON ap.idxCliente = ac.idxCliente INNER JOIN
Dipendenti d ON ra.idxDipendente = d.idxDipendente
WHERE (ra.idxDipendente = @idxDipendente OR @idxDipendente=0)
AND (ra.inizio >= CAST(@dataFrom AS DATE) AND ra.inizio <= CAST(@dataTo AS DATE))
AND (ac.idxCliente = @idxCliente OR @idxCliente <= 0)
AND (ap.idxProgetto = @idxProgetto OR @idxProgetto <= 0)
AND (af.idxFase = @idxFase OR @idxFase <= 0)
AND (af.idxFaseAncest = CASE WHEN @soloAncest <> 0 THEN 0 ELSE af.idxFaseAncest END )
ORDER BY ra.inizio
go
/**********************************************************
* STORED stp_RA_clonaLastRA_Utente
*
* clona un attività utente: se c'è da ultima altrimenti da zero x una certa data
*
* mod: S.E.L. 2013.01.17
*
**********************************************************/
alter PROCEDURE stp_RA_clonaLastRA_Utente
(
@idxDipendente INT,
@dataRif DATETIME -- data x cui creare un record attività
)
AS
-- variabili
DECLARE @idxFase INT
DECLARE @idxRA INT
-- arrotondo data richiesta solo all'ora...
SELECT @dataRif = DATEADD(HOUR, DATEPART(HOUR,@dataRif), CONVERT(DATETIME,(CONVERT(DATE,@dataRif))))
-- cerco se esista ultima reg attività utente...
SELECT @idxRA=ISNULL((SELECT TOP 1 idxRA FROM RegAttivita WHERE idxDipendente = @idxDipendente ORDER BY inizio DESC),0)
-- se non ho trovato records, ovvero idxRA = 0, prendo ultima fase da elenco
IF (@idxRA = 0)
BEGIN
-- calcolo ultima fase inserita...
SELECT TOP 1 @idxFase=ISNULL(idxFase,0) FROM AnagFasi ORDER BY idxFase DESC
-- se trovata fase inserisco!
IF(@idxFase > 0)
BEGIN
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (@idxDipendente, @idxFase, @dataRif, DATEADD(HOUR,1,@dataRif), '...',0)
END
END
ELSE
BEGIN
-- inserisco su data richeista duplicazione dell'ultima attività utente...
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione, importo)
SELECT idxDipendente, idxFase, @dataRif, DATEADD(minute, DATEDIFF(MINUTE, inizio, fine), @dataRif), descrizione, importo
FROM RegAttivita
WHERE (idxRA = @idxRA)
END
go
/**********************************************************
* STORED stp_statsProj
*
* calcolo statistiche progetto
*
* mod: S.E.L. 2012.10.31
*
**********************************************************/
alter PROCEDURE stp_statsProj
(
@idxProgetto int
)
AS
DECLARE @oreBudget DECIMAL(19,4), @oreMese DECIMAL(19,4), @oreMesePrec DECIMAL(19,4), @oreTot DECIMAL(19,4);
DECLARE @adesso DATETIME, @inizio DATETIME, @fine DATETIME;
SET @adesso = ( SELECT GETDATE() )
SET @oreBudget = (
SELECT SUM(ISNULL(budgetTime, 0))
FROM AnagFasi
WHERE idxProgetto = @idxProgetto
GROUP BY idxProgetto
)
SET @oreTot = (
SELECT ISNULL(SUM(ISNULL(ra.oreTot,0)),0) AS erogate
FROM AnagFasi af INNER JOIN RegAttivita ra ON af.idxFase = ra.idxFase
WHERE af.idxProgetto = @idxProgetto
GROUP BY af.idxProgetto
)
SET @inizio = ( SELECT dbo.Date(YEAR(@adesso), MONTH(@adesso), 1) )
SET @fine = ( SELECT dbo.Date(YEAR(@adesso), MONTH(@adesso)+1, 1) )
SET @oreMese = (
SELECT ISNULL(SUM(ISNULL(ra.oreTot,0)),0) AS erogate
FROM AnagFasi af INNER JOIN RegAttivita ra ON af.idxFase = ra.idxFase
WHERE af.idxProgetto = @idxProgetto
AND ra.inizio BETWEEN @inizio AND @fine
)
SET @inizio = ( SELECT dbo.Date(YEAR(@adesso), MONTH(@adesso)-1, 1) )
SET @fine = ( SELECT dbo.Date(YEAR(@adesso), MONTH(@adesso), 1) )
SET @oreMesePrec = (
SELECT ISNULL(SUM(ISNULL(ra.oreTot,0)),0) AS erogate
FROM AnagFasi af INNER JOIN RegAttivita ra ON af.idxFase = ra.idxFase
WHERE af.idxProgetto = @idxProgetto
AND ra.inizio BETWEEN @inizio AND @fine
)
SELECT @oreBudget AS oreBudget, @oreTot AS oreTot, @oreMese AS oreMese, @oreMesePrec AS oreMesePrec, Attivo
FROM AnagProgetti
WHERE idxProgetto = @idxProgetto
RETURN
go
/*************************************
* STORED PROCEDURE stp_VSFasiOpt_ByPrj
*
* elenco fasi dato progetto con calmpo valore a zero se fase "ancestor"
*
* mod : 2013.02.01
* aut : S.E. Locatelli
**************************************/
alter PROCEDURE stp_VSFasiOpt_ByPrj
(
@conditio INT = 0
,@soloAttivi BIT = 0 -- 0 = tutti, 1 = solo attivi x time tracking
)
AS
SELECT value as valueGroup, label, conditio, valueGroup as value
FROM v_selFasi
WHERE conditio = @conditio
AND (enableTime = @soloAttivi OR @soloAttivi = 0)
AND Attivo = 1
ORDER BY codFase, label
RETURN
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(303, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
+311
View File
@@ -0,0 +1,311 @@
alter table AnagClienti add
constraint DF_AnagClienti_codExt default ('n.d.') for codExt,
constraint DF_AnagClienti_Attivo default ((1)) for Attivo,
constraint DF_AnagClienti_OldIdx default ((-1)) for OldIdx;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
alter VIEW v_logCommUt
AS
SELECT dataLav AS Data, idxDipendente, CognomeNome, h_lav, 0.00 AS h_com, isOk AS okTimbr, isOk AS okLavCom, '---' AS progetto, minOrd, minStra, minPerm,
minFer, minMal, minFest
FROM dbo.TimbratureExpl
go
exec sp_updateextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "TimbratureExpl"
Begin Extent =
Top = 6
Left = 38
Bottom = 357
Right = 213
End
DisplayFlags = 280
TopColumn = 9
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 13
Width = 284
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_logCommUt';
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_AC_insert
*
* crea un cliente in anagrafica
*
* mod: S.E.L. 2013.02.26
*
**********************************************************/
create PROCEDURE stp_AC_insert
(
@RagSociale NVARCHAR(50),
@indirizzo NVARCHAR(50),
@CAP NVARCHAR(5),
@citta NVARCHAR(50),
@prov NVARCHAR(50),
@tel NVARCHAR(50),
@email NVARCHAR(50),
@pIva NVARCHAR(20),
@CF NVARCHAR(20),
@nota NVARCHAR(500)
)
AS
SET NOCOUNT OFF;
INSERT INTO AnagClienti(RagSociale, indirizzo, CAP, citta, prov, tel, email, pIva, CF, nota)
VALUES (@RagSociale, @indirizzo, @CAP, @citta, @prov, @tel, @email, @pIva, @CF, @nota)
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_freqProjByDipPeriodo
*
* elenco dei progetti/fasi per dipendente/periodo
*
* mod: S.E.L. 2013.02.20
*
**********************************************************/
create PROCEDURE stp_freqProjByDipPeriodo
(
@idxDipendente INT = 0, -- 0 = tutti
@inizio DATETIME,
@fine DATETIME,
@maxRes INT = 999 -- num max risultati desiderati
)
AS
-- calcolo il totale dei risultati per prima cosa...
DECLARE @totNum AS INT = 1
DECLARE @tabFreq AS TABLE
(
nomeProj NVARCHAR(250)
,nomeFase NVARCHAR(250)
,qty DECIMAL(9,3)
,idxFase INT
)
INSERT @tabFreq
SELECT TOP (@maxRes) nomeProj, nomeFase ,SUM(ra.oreTot) as qty, ra.idxFase
FROM RegAttivita ra INNER JOIN AnagFasi af ON ra.idxFase=af.idxFase
INNER JOIN AnagProgetti ap ON af.idxProgetto=ap.idxProgetto
WHERE ra.inizio BETWEEN @inizio AND @fine
AND (ra.idxDipendente = @idxDipendente OR @idxDipendente = 0 )
GROUP BY nomeProj, nomeFase, ra.idxFase
ORDER BY qty DESC
-- calcolo il totale
SELECT @totNum = ISNULL(SUM(qty),1) FROM @tabFreq
-- restituisco tab con calcolo freq reale
SELECT idxFase, nomeProj, nomeFase, qty/@totNum as freq, qty, @totNum AS tot
FROM @tabFreq
RETURN
go
/**********************************************************
* STORED stp_RA_clonaLastRA_byFaseUtente
*
* clona un attività utente: ultima di un dato tipo di fase
*
* mod: S.E.L. 2013.02.20
*
**********************************************************/
create PROCEDURE stp_RA_clonaLastRA_byFaseUtente
(
@idxDipendente INT
,@dataRif DATETIME -- data x cui creare un record attività
,@idxFase INT
)
AS
-- variabili
DECLARE @idxRA INT
DECLARE @round AS INT
SET @round = ( SELECT valInt FROM AnagKeyValue WHERE nomeVar = 'minutiRoundDay' )
-- arrotondo data richiesta...
SELECT @dataRif = DATEADD(n, (ROUND(dbo.TimeSpanUnits('m', dbo.TimeOnly(DATEADD(n,-1,@dataRif))) / @round, 2) + 1) * @round , CAST(CAST(@dataRif AS DATE) AS DATETIME))
-- controlla che x la data richiesta non ci siano già altre attività, in quel caso "accoda"...
DECLARE @trovate INT = 0
SELECT @trovate = COUNT(idxRA) FROM RegAttivita WHERE idxDipendente = @idxDipendente AND CAST(@dataRif AS DATE) = CAST(inizio AS DATE)
IF @trovate > 0
BEGIN
-- imposto @dataRif per iniziare alla fine dell'ultimo record
SELECT TOP 1 @dataRif=fine FROM RegAttivita WHERE idxDipendente = @idxDipendente AND CAST(@dataRif AS DATE) = CAST(inizio AS DATE) ORDER BY fine DESC
END
-- cerco ultima reg attività utente x fase indicata...
SELECT @idxRA=ISNULL((SELECT TOP 1 idxRA FROM RegAttivita WHERE idxDipendente = @idxDipendente AND idxFase = @idxFase ORDER BY inizio DESC),0)
-- inserisco su data richeista duplicazione dell'ultima attività utente...
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione, importo)
SELECT idxDipendente, idxFase, @dataRif, DATEADD(minute, DATEDIFF(MINUTE, inizio, fine), @dataRif), descrizione, importo
FROM RegAttivita
WHERE (idxRA = @idxRA)
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(304, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
+291
View File
@@ -0,0 +1,291 @@
create table ElencoReport(
IdxRep int not null identity constraint PK_ElencoReport primary key,
ReportName nvarchar(50),
ReportUrl nvarchar(500),
imgUrl nvarchar(50)
);
go
set xact_abort on
go
begin transaction
go
set identity_insert dbo.ElencoReport on
go
INSERT INTO dbo.ElencoReport
(IdxRep, ReportName, ReportUrl, imgUrl)
VALUES (1, N'Report Ore: Cliente - Progetto - Utente', N'GPW+-+Report+Presenze%2fGPW+-+Ore+per+Cliente-Progetto-Utente', NULL)
INSERT INTO dbo.ElencoReport
(IdxRep, ReportName, ReportUrl, imgUrl)
VALUES (2, N'Report Completo: Elenco Ore Attivita Progetti', N'GPW+-+Report+Presenze%2fGPW+-+Elenco+Ore+Attivita+Progetti', NULL)
go
set identity_insert dbo.ElencoReport off
go
commit transaction
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_ReportOreDip
*
* elenco ore dipendenti
*
* mod: S.E.L. 2013.02.04
*
**********************************************************/
alter PROCEDURE export.stp_ReportOreDip
(
@idxDipendente INT = 0, -- 0 = tutti
@dataFrom DATETIME,
@dataTo DATETIME
)
AS
SET NOCOUNT OFF;
DECLARE @minArr INT
SELECT @minArr = ISNULL(valInt,1) FROM AnagKeyValue WHERE nomeVar = 'minutiRoundDay'
-- elenco mensile...
SELECT dataLav, CognomeNome,
entrata_1, uscita_1, entrata_2, uscita_2,
entrata_3, uscita_3, entrata_4, uscita_4,
FLOOR(CAST(h_lav AS DECIMAL(9,3))*60/@minArr)/(60/@minArr) AS h_lavorate,
FLOOR(CAST(minStra AS DECIMAL(9,3))/@minArr)/(60/@minArr) AS h_straordinarie,
CEILING(CAST(minPerm AS DECIMAL(9,3))/@minArr)/(60/@minArr) AS h_permessi,
CEILING(CAST(minFer AS DECIMAL(9,3))/@minArr)/(60/@minArr) AS h_ferie,
CEILING(CAST(minMal AS DECIMAL(9,3))/@minArr)/(60/@minArr) AS h_malattia,
CEILING(CAST(minFest AS DECIMAL(9,3))/@minArr)/(60/@minArr) AS h_festivita
FROM TimbratureExpl
WHERE (idxDipendente = @idxDipendente OR @idxDipendente = 0)
AND dataLav >= CAST(@dataFrom AS DATE)
AND dataLav <= CAST(@dataTo AS DATE)
--AND NOT (entrata_1 IS NULL)
ORDER BY CognomeNome, dataLav
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_AP_Expl_getData
*
* recupera elenco progetti con filtraggio ore totali per
* - dipendente
* - periodo
*
* mod: S.E.L. 2013.01.30
*
**********************************************************/
alter PROCEDURE stp_AP_Expl_getData
(
@idxDipendente INT = 0, -- 0 = tutti
@dataFrom DATETIME = '19000101',
@dataTo DATETIME = '99991231',
@idxCliente INT = 0, -- 0 = tutti
@showPrjArch BIT = 1, -- 1 = mostra tutti, 0 = nasconde archiviati
@showPrjZeroH BIT = 1 -- 1 = mostra tutti, 0 = nasconde se zero ore caricate
)
AS
-- controllo se date nulle importo a min/max
DECLARE @firstDate DATETIME
DECLARE @lastDate DATETIME
SELECT @firstDate = MIN(inizio), @lastDate=DATEADD(DAY,1,MAX(inizio)) FROM RegAttivita
SELECT @dataFrom=ISNULL(@dataFrom, @firstDate) , @dataTo=ISNULL(@dataTo, @lastDate)
;WITH cteOreReal AS
(
SELECT ap.idxProgetto, SUM(ISNULL(ra.oreTot, 0)) AS totOre
FROM AnagProgetti AS ap INNER JOIN
AnagClienti AS ac ON ac.idxCliente=ap.idxCliente INNER JOIN
AnagFasi AS af ON ap.idxProgetto = af.idxProgetto INNER JOIN
RegAttivita AS ra ON af.idxFase = ra.idxFase
WHERE (ra.idxDipendente = @idxDipendente OR @idxDipendente = 0)
AND (ra.inizio >= @dataFrom AND ra.inizio <= @dataTo)
AND (ac.idxCliente = @idxCliente OR @idxCliente = 0)
AND (ap.Attivo = CASE WHEN @showPrjArch <> 0 THEN ap.Attivo ELSE 1 END)
GROUP BY ap.idxProgetto
)
,cteOreBudget as
(
SELECT
idxProgetto
,SUM(ISNULL(budgetTime,0)) as budgetTime
,SUM(ISNULL(budgetMoney,0)) as budgetMoney
FROM AnagFasi
GROUP BY idxProgetto
)
SELECT ac.RagSociale
, ap.idxProgetto
, ap.idxCliente
, ap.nomeProj
, ap.descrProj
, ISNULL(bdgt.budgetTime,0) AS budgetTime
, ISNULL(bdgt.budgetMoney,0) AS budgetMoney
, ISNULL(ap.OldIdx,-1) AS OldIdx
, ap.Attivo
, ISNULL(ap.codExt,'') AS codExt
, ISNULL(cte.totOre, 0) AS totOre
, ISNULL(ap.avvio,'19000101') AS avvio
, ISNULL(ap.chiusura,'99991231') AS chiusura
FROM AnagClienti AS ac INNER JOIN
AnagProgetti AS ap ON ac.idxCliente = ap.idxCliente LEFT OUTER JOIN
cteOreBudget AS bdgt ON ap.idxProgetto = bdgt.idxProgetto LEFT OUTER JOIN
cteOreReal AS cte ON cte.idxProgetto = ap.idxProgetto
WHERE (ac.idxCliente = @idxCliente OR @idxCliente = 0)
AND (ap.Attivo = CASE WHEN @showPrjArch <> 0 THEN ap.Attivo ELSE 1 END)
AND (totOre > 0 OR @showPrjZeroH = 1)
ORDER BY ac.RagSociale, ap.nomeProj
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_RA_clonaLastRA_byFaseUtente
*
* clona un attività utente: ultima di un dato tipo di fase
*
* mod: S.E.L. 2013.02.20
*
**********************************************************/
alter PROCEDURE stp_RA_clonaLastRA_byFaseUtente
(
@idxDipendente INT
,@dataRif DATETIME -- data x cui creare un record attività
,@idxFase INT
,@minuti INT = 0 -- se 0 fa last value
)
AS
-- variabili
DECLARE @idxRA INT
DECLARE @inizio DATETIME
-- calcolo fine ultima attività del giorno x l'utente (se c'è...)
SELECT TOP 1 @inizio = ISNULL(fine, @dataRif)
FROM RegAttivita
WHERE idxDipendente = @idxDipendente
AND CONVERT(DATE,fine) = @dataRif
ORDER BY fine DESC
DECLARE @round AS INT
SET @round = ( SELECT valInt FROM AnagKeyValue WHERE nomeVar = 'minutiRoundDay' )
-- arrotondo data richiesta...
SELECT @dataRif = DATEADD(n, (ROUND(dbo.TimeSpanUnits('m', dbo.TimeOnly(DATEADD(n,-1,@dataRif))) / @round, 2) + 1) * @round , CAST(CAST(@dataRif AS DATE) AS DATETIME))
-- controlla che x la data richiesta non ci siano già altre attività, in quel caso "accoda"...
DECLARE @trovate INT = 0
SELECT @trovate = COUNT(idxRA) FROM RegAttivita WHERE idxDipendente = @idxDipendente AND CAST(@dataRif AS DATE) = CAST(inizio AS DATE)
IF @trovate > 0
BEGIN
-- imposto @dataRif per iniziare alla fine dell'ultimo record
SELECT TOP 1 @dataRif=fine FROM RegAttivita WHERE idxDipendente = @idxDipendente AND CAST(@dataRif AS DATE) = CAST(inizio AS DATE) ORDER BY fine DESC
END
-- cerco ultima reg attività utente x fase indicata...
SELECT @idxRA=ISNULL((SELECT TOP 1 idxRA FROM RegAttivita WHERE idxDipendente = @idxDipendente AND idxFase = @idxFase ORDER BY inizio DESC),0)
-- inserisco su data richeista duplicazione dell'ultima attività utente...
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione, importo)
SELECT idxDipendente, idxFase, @dataRif, DATEADD(minute, CASE WHEN @minuti = 0 THEN DATEDIFF(MINUTE, inizio, fine) ELSE @minuti END, @dataRif), descrizione, importo
FROM RegAttivita
WHERE (idxRA = @idxRA)
go
commit;
go
set ANSI_NULLS on;
go
/**********************************************************
* FUNCTION f_dataOraITA
*
* formatta data ora in modo che sia compatibilit con excel ITA
*
**********************************************************/
create FUNCTION f_dataOraITA
(
@valore DATETIME
)
RETURNS NVARCHAR(50)
AS
BEGIN
RETURN CONVERT(NVARCHAR(50), @valore, 120)
END
go
/**********************************************************
* FUNCTION f_floatITA
*
* formatta data ora in modo che sia compatibilita con excel ITA
*
**********************************************************/
create FUNCTION f_floatITA
(
@valore FLOAT
)
RETURNS NVARCHAR(50)
AS
BEGIN
RETURN REPLACE(CONVERT(NVARCHAR(50), @valore),'.',',')
END
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(306, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
+118
View File
@@ -0,0 +1,118 @@
set xact_abort on;
go
begin transaction;
go
exec sp_rename 'PK_ElencoReport', 'tmp__PK_ElencoReport', 'OBJECT';
go
exec sp_rename 'ElencoReport', 'tmp__ElencoReport_0', 'OBJECT';
go
create table ElencoReport(
IdxRep int not null identity constraint PK_ElencoReport primary key,
nome nvarchar(50),
descrizione nvarchar(250),
cssClass nvarchar(250),
ReportUrl nvarchar(500)
);
go
set identity_insert ElencoReport on;
go
insert into ElencoReport(IdxRep,ReportUrl) select IdxRep,ReportUrl from tmp__ElencoReport_0;
go
set identity_insert ElencoReport off;
go
drop table tmp__ElencoReport_0;
go
commit;
go
set xact_abort on
go
begin transaction
go
UPDATE dbo.ElencoReport SET
nome=N'Report Ore', descrizione=N'Report ore raggruppato per Cliente > Progetto > Utente', cssClass=N'reportOre'
WHERE IdxRep=1
UPDATE dbo.ElencoReport SET
nome=N'Report Completo', descrizione=N' Elenco Ore Attivita Progetti (eg: valido per pivot excel)', cssClass=N'reportPivot'
WHERE IdxRep=2
go
commit transaction
go
set xact_abort on
go
begin transaction
go
UPDATE dbo.Permessi SET
NUMERO=5
WHERE COD_PERMESSO='MANAGE_Report'
go
commit transaction
go
set xact_abort on
go
begin transaction
go
INSERT INTO dbo.Permessi2Funzione
VALUES ('ADMIN', N'GPW_user', 'N')
INSERT INTO dbo.Permessi2Funzione
VALUES ('ADMIN_fasi', N'GPW_user', 'N')
INSERT INTO dbo.Permessi2Funzione
VALUES ('ADMIN_progetti', N'GPW_user', 'N')
UPDATE dbo.Permessi2Funzione SET
READWRITE='S'
WHERE COD_PERMESSO='ADMIN_spostaFasi' and COD_FUNZIONE=N'GPW_admin'
UPDATE dbo.Permessi2Funzione SET
READWRITE='S'
WHERE COD_PERMESSO='ADMIN_spostaFasi' and COD_FUNZIONE=N'GPW_prjAdm'
INSERT INTO dbo.Permessi2Funzione
VALUES ('MANAGE', N'GPW_user', 'N')
UPDATE dbo.Permessi2Funzione SET
READWRITE='S'
WHERE COD_PERMESSO='MANAGE_Report' and COD_FUNZIONE=N'GPW_admin'
UPDATE dbo.Permessi2Funzione SET
READWRITE='S'
WHERE COD_PERMESSO='MANAGE_Report' and COD_FUNZIONE=N'GPW_prjAdm'
INSERT INTO dbo.Permessi2Funzione
VALUES ('MANAGE_Report', N'GPW_user', 'N')
UPDATE dbo.Permessi2Funzione SET
READWRITE='S'
WHERE COD_PERMESSO='MANAGE_SpostOre' and COD_FUNZIONE=N'GPW_admin'
UPDATE dbo.Permessi2Funzione SET
READWRITE='S'
WHERE COD_PERMESSO='MANAGE_SpostOre' and COD_FUNZIONE=N'GPW_prjAdm'
go
commit transaction
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(308, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
+93
View File
@@ -0,0 +1,93 @@
set ANSI_NULLS on;
go
create FUNCTION f_expDataGGMMAAAA( @Data AS DATE )
-- ritorna la DATA per file di export x paghe formato carattere
RETURNS CHAR(8)
AS
BEGIN
RETURN REPLACE( CONVERT(NVARCHAR(50), @Data , 105), '-','')
END
go
create FUNCTION f_expTimeHHMM( @Time AS DECIMAL(10,5) , @Format CHAR(1), @Arrot AS INT)
-- ritorna ore per file di export x paghe formato carattere es . 8 0re 30 minuti -> 0850
-- Time valore da convertire
-- Format Formato del valore passato ( M-minuti O-Ore )
RETURNS CHAR(4)
AS
BEGIN
DECLARE @Ore AS INT;
DECLARE @Min AS INT;
DECLARE @OreMin AS DECIMAL(10,5);
IF @Format = 'M' -- Minuti
BEGIN
-- SET @Ore = CONVERT( INTEGER , ( @Time / 60.00 ) );
-- SET @Min = @Time - ( @Ore * 60 );
SET @OreMin = CONVERT(INT, (@Time / @Arrot) )
SET @OreMin = ( ( @OreMin * @Arrot ) / 60 ) * 100
END
RETURN dbo.f_padLeft( CONVERT( VARCHAR(4) , CONVERT(INT, @OreMin )) , 4, '0')
END
go
/***************************************
* FUNCTION f_padLeft
*
* fornisce una stringa della lunghezza desiderata aggiungendo a sx il carattere richiesto alla @string originale
*
* Steamware, S.E.L.
* mod: 2010.03.19
*
****************************************/
create FUNCTION f_padLeft (@string VARCHAR(255), @desired_length INTEGER, @pad_character CHAR(1))
RETURNS VARCHAR(255) AS
BEGIN
-- Prefix the required number of spaces to bulk up the string and then replace the spaces with the desired character
RETURN CASE
WHEN LEN(@string) < @desired_length
THEN REPLACE(SPACE(@desired_length - LEN(@string)), ' ', @pad_character) + @string
ELSE @string
END
END
go
/***************************************
* FUNCTION f_padLeft
*
* fornisce una stringa della lunghezza desiderata aggiungendo a sx il carattere richiesto alla @string originale
*
* Steamware, S.E.L.
* mod: 2010.03.19
*
****************************************/
create FUNCTION f_padRight (@string VARCHAR(255), @desired_length INTEGER, @pad_character CHAR(1))
RETURNS VARCHAR(255) AS
BEGIN
-- Prefix the required number of spaces to bulk up the string and then replace the spaces with the desired character
RETURN CASE
WHEN LEN(@string) < @desired_length
THEN @string + REPLACE(SPACE(@desired_length - LEN(@string)), ' ', @pad_character)
ELSE @string
END
END
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(312, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
+26
View File
@@ -0,0 +1,26 @@
set xact_abort on
go
begin transaction
go
UPDATE dbo.AnagKeyValue SET
descrizione=N'arrotondamento standard valori'
WHERE nomeVar=N'minutiRound'
INSERT INTO dbo.AnagKeyValue
VALUES (N'minutiRoundDay', 15, NULL, NULL, N'arrotondamento giornaliero')
INSERT INTO dbo.AnagKeyValue
VALUES (N'minutiRoundExtraFascia', 15, NULL, NULL, N'arrotondamento periodi fuori fascia ingresso/uscita')
go
commit transaction
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(314, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
+127
View File
@@ -0,0 +1,127 @@
set xact_abort on;
go
begin transaction;
go
alter table AnagKeyValue alter column
valString nvarchar(250);
go
alter table AnagKeyValue add
constraint DF_AnagKeyValue_valInt default ((0)) for valInt,
constraint DF_AnagKeyValue_descrizione default ('-') for descrizione,
constraint DF_AnagKeyValue_valFloat default ((0)) for valFloat,
constraint DF_AnagKeyValue_valString default ('') for valString;
go
commit;
go
set xact_abort on;
go
begin transaction;
go
alter table Dipendenti add
dataAssunzione date constraint DF_Dipendenti_dataAssunzione default ('1900-01-01'),
dataCessazione date constraint DF_Dipendenti_dataCessazione default ('9999-12-31'),
attivo bit constraint DF_Dipendenti_attivo default ((1));
go
update Dipendenti set dataAssunzione=('1900-01-01'),dataCessazione=('9999-12-31'),attivo=((1));
go
set ANSI_NULLS on;
go
-- =============================================
-- Author: S.E. Locatelli
-- Create date: 2013-03-25
-- Description: Recupero elenco dip attivi
-- =============================================
create PROCEDURE stp_Dip_getAttivi
AS
SET NOCOUNT ON;
SELECT *
FROM Dipendenti
WHERE (attivo = 1)
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_AKV_getByKey
*
* elenco valori da chiave x tab anagrafica key/val
*
* mod: S.E.L. 2013.03.25
*
**********************************************************/
create PROCEDURE stp_AKV_getByKey
(
@nomeVar NVARCHAR(50)
)
AS
SET NOCOUNT ON;
SELECT nomeVar
,ISNULL(valInt,0) AS valInt
,ISNULL(valFloat,0) AS valFloat
,ISNULL(valString,'') AS valString
,ISNULL(descrizione,'') AS descrizione
FROM AnagKeyValue
WHERE nomeVar = @nomeVar
go
commit;
go
set xact_abort on
go
begin transaction
go
UPDATE dbo.AnagKeyValue SET
valFloat=0, valString=N''
WHERE nomeVar=N'minutiRound'
UPDATE dbo.AnagKeyValue SET
valFloat=0, valString=N''
WHERE nomeVar=N'minutiRoundDay'
UPDATE dbo.AnagKeyValue SET
valFloat=0, valString=N''
WHERE nomeVar=N'minutiRoundExtraFascia'
INSERT INTO dbo.AnagKeyValue
VALUES (N'appMode', 0, 0, N'runtime', N'modalità applicazione (runtime)')
INSERT INTO dbo.AnagKeyValue
VALUES (N'installazione', 0, 0, N'ETS', N'nome installazione')
INSERT INTO dbo.AnagKeyValue
VALUES (N'ETS', 10, 0, N'+FBqyG1V4kqbqYe/IO7KywpmR9YzujB0', N'licenze e codice auth applicativo')
go
commit transaction
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(320, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
File diff suppressed because it is too large Load Diff
+865
View File
@@ -0,0 +1,865 @@
create table AnagTipoCheck(
chkFun nvarchar(50) not null constraint PK_AnagTipoCheck primary key,
descrFun nvarchar(50)
);
go
set xact_abort on
go
begin transaction
go
INSERT INTO dbo.AnagTipoCheck
VALUES (N'PP30m', N'Pausa pranzo 30 min')
INSERT INTO dbo.AnagTipoCheck
VALUES (N'PP60m', N'Pausa pranzo 60 min')
go
commit transaction
go
set xact_abort on;
go
begin transaction;
go
alter table AnagOrari add
chkFun nvarchar(50) constraint DF_AnagOrari_checkFun default ('');
go
exec sp_addextendedproperty 'MS_Description', 'parametro (opzionale) da passare alla funzione di check "finale" per verifica giornate lavorate in tab TimbratureExpl', 'SCHEMA', 'dbo', 'TABLE', 'AnagOrari', 'COLUMN', 'chkFun';
go
update AnagOrari set chkFun=('');
go
set ANSI_NULLS on;
go
commit;
go
/******************************************************************************
* FUNCTION f_chkFunDip
*
* restituisce il nome della funzione di check da applicare dato profilo orario
*
* mod: S.E.L. 2013.03.28
*
*******************************************************************************/
create FUNCTION f_chkFunDip
(
@idxDipendente INT
)
RETURNS NVARCHAR(50)
AS
BEGIN
DECLARE @chkFun NVARCHAR(50) = ''
SELECT @chkFun = ISNULL(chkFun,'')
FROM AnagOrari ao INNER JOIN Dipendenti d ON ao.codOrario=d.codOrario
WHERE d.idxDipendente = @idxDipendente
RETURN @chkFun
END
go
set xact_abort on;
go
begin transaction;
go
alter table TimbratureExpl drop
constraint DF_TimbratureExpl_minOrd ,
constraint DF_TimbratureExpl_minLav ,
constraint DF_TimbratureExpl_minStra ,
constraint DF_TimbratureExpl_minNonLav ,
constraint DF_TimbratureExpl_minFest ,
constraint DF_TimbratureExpl_minPerm ,
constraint DF_TimbratureExpl_minFer ,
constraint DF_TimbratureExpl_minFest1 ,
constraint DF_TimbratureExpl_block ,
constraint DF_TimbratureExpl_isOkTim ,
constraint DF_TimbratureExpl_isOk ;
go
exec sp_rename 'PK_TimbratureExpl_1', 'tmp__PK_TimbratureExpl_1', 'OBJECT';
go
exec sp_rename 'TimbratureExpl', 'tmp__TimbratureExpl_2', 'OBJECT';
go
create table TimbratureExpl(
dataLav date not null,
idxDipendente int not null,
CognomeNome nvarchar(100),
entrata_1 datetime,
uscita_1 datetime,
entrata_2 datetime,
uscita_2 datetime,
entrata_3 datetime,
uscita_3 datetime,
entrata_4 datetime,
uscita_4 datetime,
h_lav float,
h_giust as ((((CONVERT([float],[minPerm],(0))+[minFer])+[minMal])+[minFest])/(60)),
minLav int constraint DF_TimbratureExpl_minLav default ((0)),
minOrd int constraint DF_TimbratureExpl_minOrd default ((0)),
minNonLav int constraint DF_TimbratureExpl_minNonLav default ((0)),
minStra int constraint DF_TimbratureExpl_minStra default ((0)),
minPerm int constraint DF_TimbratureExpl_minPerm default ((0)),
minFer int constraint DF_TimbratureExpl_minFer default ((0)),
minMal int constraint DF_TimbratureExpl_minFest1 default ((0)),
minFest int constraint DF_TimbratureExpl_minFest default ((0)),
minArcoPres as (datediff(minute,isnull([entrata_1],getdate()),isnull(isnull([uscita_4],isnull([uscita_3],isnull([uscita_2],isnull([uscita_1],[entrata_1])))),getdate()))),
isOkTim bit constraint DF_TimbratureExpl_isOkTim default ((0)),
isOkApp bit constraint DF_TimbratureExpl_isOk default ((1)),
isOkLav as (case when [minOrd]<=(((([minLav]+[minPerm])+[minFer])+[minMal])+[minFest]) then (1) else (0) end),
isOk as (([isOkTim]&[isOkApp])&case when [minOrd]<=(((([minLav]+[minPerm])+[minFer])+[minMal])+[minFest]) then (1) else (0) end),
block bit constraint DF_TimbratureExpl_block default ((0)),
chkFunCod nvarchar(50) constraint DF_TimbratureExpl_chkFunRes default (''),
chkFunRes nvarchar(50) constraint DF_TimbratureExpl_chkFunRes1 default (''),
constraint PK_TimbratureExpl_1 primary key(dataLav,idxDipendente)
);
go
create index ix_idxDip on TimbratureExpl(idxDipendente)
include(dataLav,CognomeNome,h_lav,minOrd,minStra,minPerm,minFer,block,isOkApp,isOkTim);
go
create index ix_TimbrExpl_CognomeNome_DataLav on TimbratureExpl(CognomeNome,dataLav);
go
exec sp_addextendedproperty 'MS_Description', 'totale ore giustificate', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'h_giust';
go
exec sp_addextendedproperty 'MS_Description', 'minuti non lavorati (ovvero se fatti meno di ordinari e senza giustificativi)', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'minNonLav';
go
exec sp_addextendedproperty 'MS_Description', 'DATEDIFF(n, ISNULL(entrata_1,GETDATE()), ISNULL(ISNULL(uscita_4,ISNULL(uscita_3,ISNULL(uscita_2,ISNULL(uscita_1,entrata_1)))),GETDATE()))', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'minArcoPres';
go
exec sp_addextendedproperty 'MS_Description', 'dato sintetico x indicare se TUTTE le timbrature componenti siano approvate', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'isOkApp';
go
exec sp_addextendedproperty 'MS_Description', 'determina se la giornata sia ok (oreLav + giustificativi >= oreOrd)', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'isOkLav';
go
exec sp_addextendedproperty 'MS_Description', 'determina se il record sia "bloccato" (archiviazione e blocco mesi precedenti...)', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'block';
go
exec sp_addextendedproperty 'MS_Description', 'eventuale diagnostica da check function sulla riga indicata (codice)', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'chkFunCod';
go
exec sp_addextendedproperty 'MS_Description', 'eventuale diagnostica da check function sulla riga indicata (spiegazione)', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'chkFunRes';
go
insert into TimbratureExpl(dataLav,idxDipendente,CognomeNome,entrata_1,uscita_1,entrata_2,uscita_2,entrata_3,uscita_3,entrata_4,uscita_4,h_lav,minLav,minOrd,minNonLav,minStra,minPerm,minFer,minMal,minFest,isOkTim,isOkApp,block) select dataLav,idxDipendente,CognomeNome,entrata_1,uscita_1,entrata_2,uscita_2,entrata_3,uscita_3,entrata_4,uscita_4,h_lav,minLav,minOrd,minNonLav,minStra,minPerm,minFer,minMal,minFest,isOkTim,isOkApp,block from tmp__TimbratureExpl_2;
go
drop table tmp__TimbratureExpl_2;
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
create VIEW v_selCodOrario
AS
SELECT codOrario AS value, codOrario AS label
FROM dbo.AnagOrari
go
exec sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "AnagOrari"
Begin Extent =
Top = 6
Left = 38
Bottom = 200
Right = 223
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 3810
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_selCodOrario';
go
exec sp_addextendedproperty 'MS_DiagramPaneCount', 1, 'SCHEMA', 'dbo', 'VIEW', 'v_selCodOrario';
go
create VIEW v_selTipoChk
AS
SELECT chkFun AS value, descrFun AS label
FROM dbo.AnagTipoCheck
go
exec sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "AnagTipoCheck"
Begin Extent =
Top = 6
Left = 38
Bottom = 102
Right = 208
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 1755
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_selTipoChk';
go
exec sp_addextendedproperty 'MS_DiagramPaneCount', 1, 'SCHEMA', 'dbo', 'VIEW', 'v_selTipoChk';
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_AD_insertQuery
*
* aggiunge un dipendente in anagrafica
*
* mod: S.E.L. 2012.10.29
*
**********************************************************/
alter PROCEDURE stp_AD_insertQuery
(
@matricola NVARCHAR(50),
@CF NVARCHAR(16),
@Cognome NVARCHAR(50),
@Nome NVARCHAR(50),
@dataNascita DATETIME,
@luogoNascita NVARCHAR(50),
@provNascita NVARCHAR(50),
@nazNascita NVARCHAR(50),
@email NVARCHAR(250),
@dominio NVARCHAR(50),
@utente NVARCHAR(50),
@codOrario NVARCHAR(50),
@attivo BIT
)
AS
SET NOCOUNT OFF;
INSERT INTO Dipendenti
(matricola, CF, Cognome, Nome, dataNascita, luogoNascita, provNascita, nazNascita, email, dominio, utente,codOrario,attivo)
VALUES (@matricola,@CF,@Cognome,@Nome,@dataNascita,@luogoNascita,UPPER(@provNascita),UPPER(@nazNascita),@email,@dominio,@utente,@codOrario,@attivo);
SELECT * FROM Dipendenti WHERE (idxDipendente = SCOPE_IDENTITY())
go
/**********************************************************
* STORED stp_AD_updateQuery
*
* aggiorna un dipendente da anagrafica
*
* mod: S.E.L. 2012.10.29
*
**********************************************************/
alter PROCEDURE stp_AD_updateQuery
(
@matricola NVARCHAR(50),
@CF NVARCHAR(16),
@Cognome NVARCHAR(50),
@Nome NVARCHAR(50),
@dataNascita datetime,
@luogoNascita NVARCHAR(50),
@provNascita NVARCHAR(50),
@nazNascita NVARCHAR(50),
@email NVARCHAR(250),
@dominio NVARCHAR(50),
@utente NVARCHAR(50),
@codOrario NVARCHAR(50),
@attivo BIT,
@Original_idxDipendente int
)
AS
SET NOCOUNT OFF;
UPDATE Dipendenti
SET matricola = @matricola, CF = @CF, Cognome = @Cognome, Nome = @Nome, dataNascita = @dataNascita, luogoNascita = @luogoNascita,
provNascita = UPPER(@provNascita), nazNascita = UPPER(@nazNascita), email = @email, dominio = @dominio, utente = @utente
,codOrario = @codOrario, attivo = @attivo
WHERE (idxDipendente = @Original_idxDipendente);
SELECT * FROM Dipendenti WHERE (idxDipendente = @Original_idxDipendente)
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/*******************************************************************************
* STORED PROCEDURE stp_TE_doChkFun
*
* effettua check finali sulla riga di timbrature esplore indicata, contiene varie logiche
* anche da + installazioni clienti
*
* mod: S.E.L. 2013.03.28
*
*******************************************************************************/
create PROCEDURE stp_TE_doChkFun
(
@idxDipendente INT,
@dataRif DATETIME
)
AS
SET NOCOUNT ON;
-- recupero tipo di fuction da usare
DECLARE @chkFun NVARCHAR(50) = ''
DECLARE @minPP INT = 0
SELECT @chkFun = dbo.f_chkFunDip(@idxDipendente)
-- controllo tipo di funzione... e imposto risultato!
IF(@chkFun = 'PP60m')
BEGIN
SET @minPP = 60
UPDATE TimbratureExpl
SET chkFunCod = 'P',
chkFunRes = 'Mancata pausa pranzo 60m'
WHERE idxDipendente = @idxDipendente AND dataLav = @dataRif
AND (minArcoPres - minLav) < @minPP -- controllo pause > PP imposta
AND (minOrd > 0 AND minLav > 0) -- controllo DEBBA lavorare e ABBIA lavorato
END
ELSE IF(@chkFun = 'PP30m')
BEGIN
SET @minPP = 30
UPDATE TimbratureExpl
SET chkFunCod = 'P',
chkFunRes = 'Mancata pausa pranzo 30m'
WHERE idxDipendente = @idxDipendente AND dataLav = @dataRif
AND (minArcoPres - minLav) < @minPP -- controllo pause > PP imposta
AND (minOrd > 0 AND minLav > 0) -- controllo DEBBA lavorare e ABBIA lavorato
END
RETURN
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/*******************************************************************************
* stp_ricalcolaTimbratureExpl
*
* Aggiorna la tab timbrature expl ricalcolando la giornata del record interessato
* mod: S.E.L. - 2012.02.06
********************************************************************************/
alter PROCEDURE stp_ricalcolaTimbratureExpl
(
@idxDipendente AS INT,
@dataRif AS DATETIME
)
AS
-- variabili
DECLARE @minArr INT
SELECT @minArr=dbo.f_minArrotDip(@idxDipendente)
-- CONTROLLO SE IL RECORD NON SIA BLOCCATO!!!
DECLARE @block BIT
SET @block = ( SELECT ISNULL(( SELECT block FROM TimbratureExpl WHERE (idxDipendente = @idxDipendente) AND CONVERT(DATE,dataLav) = CONVERT(DATE,@dataRif) ),0) )
IF(@block = 0)
BEGIN
-- elimino i periodi della data indicata...
DELETE FROM TimbratureExpl
WHERE (idxDipendente = @idxDipendente) AND CONVERT(DATE,dataLav) = CONVERT(DATE,@dataRif)
-- inserisco i dati minimi per la data indicata
INSERT INTO TimbratureExpl(idxDipendente, dataLav)
VALUES(@idxDipendente, CONVERT(DATE,@dataRif))
-- aggiorno cognome nome
BEGIN TRY
UPDATE te
SET CognomeNome = ISNULL(vcn.CognomeNome,'')
FROM TimbratureExpl te INNER JOIN v_cognomeNome vcn ON te.idxDipendente = vcn.idxDipendente
WHERE CONVERT(DATE,te.dataLav) = CONVERT(DATE,@dataRif) AND te.idxDipendente = @idxDipendente
END TRY
BEGIN CATCH
-- non faccio nulla
END CATCH
-- aggiorno 1° timbratura
UPDATE te
SET te.entrata_1 = pl.entrata,
te.uscita_1 = pl.uscita
FROM TimbratureExpl te INNER JOIN PeriodiLav pl ON
te.idxDipendente = pl.idxDipendente AND
(CONVERT(DATE,te.dataLav) = CONVERT(DATE,pl.entrata))
WHERE pl.rowNum = 1 AND te.idxDipendente = @idxDipendente AND CONVERT(DATE,pl.entrata) = CONVERT(DATE,@dataRif)
-- aggiorno 2° timbratura
UPDATE te
SET te.entrata_2 = pl.entrata,
te.uscita_2 = pl.uscita
FROM TimbratureExpl te INNER JOIN PeriodiLav pl ON te.idxDipendente = pl.idxDipendente
AND (CONVERT(DATE,te.dataLav) = CONVERT(DATE,pl.entrata))
WHERE pl.rowNum = 2 AND te.idxDipendente = @idxDipendente AND CONVERT(DATE,pl.entrata) = CONVERT(DATE,@dataRif)
-- aggiorno 3° timbratura
UPDATE te
SET te.entrata_3 = pl.entrata,
te.uscita_3 = pl.uscita
FROM TimbratureExpl te INNER JOIN PeriodiLav pl ON te.idxDipendente = pl.idxDipendente
AND (CONVERT(DATE,te.dataLav) =CONVERT(DATE,pl.entrata))
WHERE pl.rowNum = 3 AND te.idxDipendente = @idxDipendente AND CONVERT(DATE,pl.entrata) = CONVERT(DATE,@dataRif)
-- aggiorno 4° timbratura
UPDATE te
SET te.entrata_4 = pl.entrata,
te.uscita_4 = pl.uscita
FROM TimbratureExpl te INNER JOIN PeriodiLav pl ON te.idxDipendente = pl.idxDipendente
AND (CONVERT(DATE,te.dataLav) =CONVERT(DATE,pl.entrata))
WHERE pl.rowNum = 4 AND te.idxDipendente = @idxDipendente AND CONVERT(DATE,pl.entrata) = CONVERT(DATE,@dataRif)
-- calcolo ore totali...
UPDATE TimbratureExpl
SET h_lav = CAST(FLOOR((ISNULL(DATEDIFF(n,entrata_1,uscita_1),0) + ISNULL(DATEDIFF(n,entrata_2,uscita_2),0) + ISNULL(DATEDIFF(n,entrata_3,uscita_3),0) + ISNULL(DATEDIFF(n,entrata_4,uscita_4),0))/@minArr) AS FLOAT)*@minArr/60
FROM TimbratureExpl
WHERE (CONVERT(DATE,dataLav) = CONVERT(DATE,@dataRif)) AND idxDipendente = @idxDipendente
-- verifico: se c'è anche solo 1 timbratura non approvata metto flag isOkApp a falso
UPDATE TimbratureExpl
SET isOkApp = ISNULL((
SELECT MIN(CASE WHEN Approv=0 THEN 0 ELSE 1 END) AS isOk
FROM Timbrature
WHERE idxDipendente = @idxDipendente
AND (CONVERT(DATE,dataOra) = CONVERT(DATE,@dataRif))
GROUP BY CONVERT(DATE,dataOra)
),1)
FROM TimbratureExpl
WHERE (CONVERT(DATE,dataLav) = CONVERT(DATE,@dataRif)) AND idxDipendente = @idxDipendente
-- verifico: se entrate <> uscite flag isOkTim a falso
UPDATE TimbratureExpl
SET isOkTim = (
SELECT CASE WHEN
ISNULL(
(SELECT COUNT(*) as timb
FROM Timbrature AS t
WHERE t.idxDipendente = @idxDipendente
AND (CONVERT(DATE,dataOra) = CONVERT(DATE,@dataRif))
GROUP BY t.idxDipendente , CONVERT(DATE,t.dataOra)
HAVING COUNT ( CASE Entrata WHEN 1 THEN dataOra END ) <> COUNT ( CASE Entrata WHEN 0 THEN dataOra END )
),0) > 0 THEN 0 ELSE 1 END
)
FROM TimbratureExpl
WHERE (CONVERT(DATE,dataLav) = CONVERT(DATE,@dataRif)) AND idxDipendente = @idxDipendente
-- calcolo resoconto MINUTI giornaliero, imposto LUN x inizio settimana
SET DATEFIRST 1
-- MIN lavorati, ordinari (con arrotondamento...)
UPDATE TimbratureExpl
SET minLav = CAST((ISNULL(DATEDIFF(n,entrata_1,uscita_1),0) + ISNULL(DATEDIFF(n,entrata_2,uscita_2),0) + ISNULL(DATEDIFF(n,entrata_3,uscita_3),0) + ISNULL(DATEDIFF(n,entrata_4,uscita_4),0)) AS FLOAT)
,minOrd = dbo.f_oreOrdDip(idxDipendente,dataLav) * 60 -- da schema orario dip attivo
FROM TimbratureExpl
WHERE (CONVERT(DATE,dataLav) = CONVERT(DATE,@dataRif)) AND idxDipendente = @idxDipendente
-- MIN non lavorati, straordinari (con arrotondamento...)
UPDATE TimbratureExpl
SET minNonLav = (CEILING(CONVERT(FLOAT,CASE WHEN minOrd <= minLav THEN (0) ELSE minOrd-minLav END)/@minArr)*@minArr)
,minStra = (FLOOR(CONVERT(FLOAT,CASE WHEN minOrd < minLav AND minLav > (0) THEN minLav-minOrd ELSE (0) END)/@minArr)*@minArr)
FROM TimbratureExpl
WHERE (CONVERT(DATE,dataLav) = CONVERT(DATE,@dataRif)) AND idxDipendente = @idxDipendente
-- MIN da tab giustificativi (feste, ferie, malattia, permessi)
UPDATE TimbratureExpl
SET minMal = CASE WHEN g.codGiust='MAL' THEN g.minuti ELSE minMal END,
minFer = CASE WHEN g.codGiust='FER' THEN g.minuti ELSE minFer END,
minFest = CASE WHEN g.codGiust='FEST' THEN g.minuti ELSE minFest END,
minPerm = CASE WHEN g.codGiust='PERM' THEN g.minuti ELSE minPerm END,
chkFunCod = '',
chkFunRes = ''
FROM TimbratureExpl te INNER JOIN Giustificativi g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav
WHERE (CONVERT(DATE,te.dataLav) = CONVERT(DATE,@dataRif)) AND te.idxDipendente = @idxDipendente
-- verifico SE codice orario richieda una chkFun eseguo calcolo...
IF(dbo.f_chkFunDip(@idxDipendente)<>'')
BEGIN
EXEC stp_TE_doChkFun @idxDipendente, @dataRif
END
END
RETURN
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_lcuByDipDate
*
* elenco dati COMPLETI di timbratura e commessa per utente/periodo
*
* mod: S.E.L. 2012.11.02
*
**********************************************************/
alter PROCEDURE stp_TE_RA_ByUserDate
(
@idxDipendente INT,
@dataFrom DATETIME,
@dataTo DATETIME,
@showWE BIT = 1, -- imposto visualizzazione week-end a true di default
@maxErrMin INT = 0, -- minuti massimi di scostamento consentiti per DIFETTO, default 0
@maxErrPlus INT = 0 -- minuti massimi di scostamento consentiti per ECCESSO, default 0
)
with recompile
AS
BEGIN
-- imposto LUN x inizio settimana
SET DATEFIRST 1
-- faccio una tab temporanea con tallyTable x calcolo periodo intero...
DECLARE @numD INT
SET @numD = ( SELECT DATEDIFF(dd, @dataFrom, @dataTo ) )
-- tab dei record RegAttività progetti
;WITH myCteRA AS
(
SELECT idxDipendente, dataLav, minRegAtt, descrProj
FROM dbo.RegAttivitaExpl
WHERE (idxDipendente = @idxDipendente OR @idxDipendente = 0) AND (dataLav >= DATEADD(DAY,-1,@dataFrom) AND dataLav <= @dataTo)
)
SELECT mc.Data as dataLav
,mc.idxDipendente
,ISNULL(dip.Cognome + ' ' + dip.Nome,'') AS CognomeNome
-- ore base + progetti
,ISNULL(te.h_lav,0) AS h_lav
,ISNULL(te.h_giust,0) AS h_giust
,CAST(ISNULL(vra.minRegAtt,0) AS DECIMAL(9,3))/60 AS h_com
,ISNULL(vra.descrProj,'') as progetti
-- check coerenza
,CASE WHEN ISNULL(vra.minRegAtt,0)-ISNULL(te.h_lav,0)*60 >= @maxErrMin AND ISNULL(vra.minRegAtt,0)-ISNULL(te.h_lav,0)*60 <= @maxErrPlus THEN 1 ELSE 0 END AS okLavCom
,ISNULL(te.isOkTim,0) AS isOkTim
,ISNULL(te.isOkApp,0) AS isOkApp
,ISNULL(te.isOkLav,0) AS isOkLav
,ISNULL(te.isOk,0) AS isOk
-- check blocco
,ISNULL(te.block,0) AS block
-- dettaglio minuti
,ISNULL(te.minOrd,0) AS minOrd
,ISNULL(te.minNonLav,0) AS minNonLav
,ISNULL(te.minStra,0) AS minStra
,ISNULL(te.minPerm,0) AS minPerm
,ISNULL(te.minFer,0) AS minFer
,ISNULL(te.minMal,0) AS minMal
,ISNULL(te.minFest,0) AS minFest
,ISNULL(te.minArcoPres,0) AS minArcoPres
,ISNULL(vra.minRegAtt,0) AS minRegAtt
-- dettaglio entrate
, te.entrata_1, te.uscita_1
, te.entrata_2, te.uscita_2
, te.entrata_3, te.uscita_3
, te.entrata_4, te.uscita_4
-- dati check
, te.chkFunCod, te.chkFunRes
FROM (SELECT CONVERT(DATE,DATEADD(dd, -N, @dataTo)) as Data, idxDipendente
FROM Tally, Dipendenti
WHERE N <= @numD
AND (idxDipendente = @idxDipendente OR @idxDipendente = 0)
) AS mc
LEFT OUTER JOIN myCteRA vra ON mc.Data = vra.dataLav AND mc.idxDipendente=vra.idxDipendente
LEFT OUTER JOIN TimbratureExpl te ON mc.Data=te.dataLav AND te.idxDipendente=mc.idxDipendente
LEFT OUTER JOIN Dipendenti dip ON dip.idxDipendente=mc.idxDipendente
WHERE (te.idxDipendente = @idxDipendente OR @idxDipendente = 0)
AND DATEPART(dw, mc.Data) <= CASE WHEN @showWE=0 THEN 5 ELSE 7 END --solo lun-ven, 1-5
ORDER BY mc.Data DESC, dip.Cognome, dip.Nome
END
RETURN
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(324, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
+273
View File
@@ -0,0 +1,273 @@
create table ListValues(
TableName nvarchar(50) not null,
FieldName nvarchar(50) not null,
value nvarchar(10) not null,
label nvarchar(50),
ordinal int constraint DF_ListValues_ordinal default ((0)),
constraint PK_ListValues_1 primary key(TableName,FieldName,value)
);
go
set xact_abort on
go
begin transaction
go
INSERT INTO dbo.ListValues
VALUES (N'*', N'PageSize', N'10', N'10', 1)
INSERT INTO dbo.ListValues
VALUES (N'*', N'PageSize', N'15', N'15', 2)
INSERT INTO dbo.ListValues
VALUES (N'*', N'PageSize', N'20', N'20', 3)
INSERT INTO dbo.ListValues
VALUES (N'*', N'PageSize', N'35', N'35', 4)
INSERT INTO dbo.ListValues
VALUES (N'*', N'PageSize', N'50', N'50', 5)
go
commit transaction
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/*----------------------------------
* Trigger su insert/update
*
* Aggiorna giustificativi nella tab TimbratureExpl
*
* creato da: S.E. Locatelli - 2012.12.04
* ultima modifica:
*----------------------------------*/
alter TRIGGER trg_giustUpdateTimbr
ON Giustificativi
FOR INSERT, UPDATE
AS
-- controllo se rescord esista altrimenti lo creo!!!
DECLARE @trovate INT = 0
DECLARE @idxDipendente INT
DECLARE @dataRif DATETIME
SET @trovate = ISNULL( ( SELECT COUNT(*) FROM TimbratureExpl te INNER JOIN inserted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav) ,0)
IF(@trovate = 0)
BEGIN
SELECT @idxDipendente = idxDipendente, @dataRif=dataLav FROM inserted
EXEC stp_ricalcolaTimbratureExpl @idxDipendente, @dataRif
END
-- CONTROLLO SE IL RECORD NON SIA BLOCCATO con where nell'update
-- prendo tutte le "vecchie" righe (deleted) e x le giornate relative TOLGO i minuti dei giustificativi
UPDATE TimbratureExpl
SET minMal = CASE WHEN g.codGiust='MAL' THEN 0 ELSE minMal END,
minFer = CASE WHEN g.codGiust='FER' THEN 0 ELSE minFer END,
minFest = CASE WHEN g.codGiust='FEST' THEN 0 ELSE minFest END,
minPerm = CASE WHEN g.codGiust='PERM' THEN 0 ELSE minPerm END
FROM TimbratureExpl te INNER JOIN deleted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav
WHERE te.block = 0
-- prendo le "nuove" righe (inserted) e x le giornate relative AGGIUNGO i minuti dei giustificativi
UPDATE TimbratureExpl
SET minMal = CASE WHEN g.codGiust='MAL' THEN g.minuti ELSE minMal END,
minFer = CASE WHEN g.codGiust='FER' THEN g.minuti ELSE minFer END,
minFest = CASE WHEN g.codGiust='FEST' THEN g.minuti ELSE minFest END,
minPerm = CASE WHEN g.codGiust='PERM' THEN g.minuti ELSE minPerm END
FROM TimbratureExpl te INNER JOIN inserted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav
WHERE te.block = 0
go
/*----------------------------------
* Trigger su delete
*
* Aggiorna giustificativi nella tab TimbratureExpl
*
* creato da: S.E. Locatelli - 2012.12.04
* ultima modifica:
*----------------------------------*/
alter TRIGGER trg_giustDelUpdTimbr
ON Giustificativi
FOR DELETE
AS
-- controllo se rescord esista altrimenti lo creo!!!
DECLARE @trovate INT = 0
DECLARE @idxDipendente INT
DECLARE @dataRif DATETIME
-- CONTROLLO SE IL RECORD NON SIA BLOCCATO in update con where
-- prendo tutte le "vecchie" righe (deleted) e x le giornate relative TOLGO i minuti dei giustificativi
UPDATE TimbratureExpl
SET minMal = CASE WHEN g.codGiust='MAL' THEN 0 ELSE minMal END,
minFer = CASE WHEN g.codGiust='FER' THEN 0 ELSE minFer END,
minFest = CASE WHEN g.codGiust='FEST' THEN 0 ELSE minFest END,
minPerm = CASE WHEN g.codGiust='PERM' THEN 0 ELSE minPerm END
FROM TimbratureExpl te INNER JOIN deleted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav
WHERE te.block = 0
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
create VIEW v_selPageSize
AS
SELECT TOP (100) PERCENT value, label, ordinal
FROM dbo.ListValues
WHERE (TableName = N'*') AND (FieldName = N'PageSize')
go
exec sp_addextendedproperty 'MS_DiagramPane1', '[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties =
Begin PaneConfigurations =
Begin PaneConfiguration = 0
NumPanes = 4
Configuration = "(H (1[40] 4[20] 2[20] 3) )"
End
Begin PaneConfiguration = 1
NumPanes = 3
Configuration = "(H (1 [50] 4 [25] 3))"
End
Begin PaneConfiguration = 2
NumPanes = 3
Configuration = "(H (1 [50] 2 [25] 3))"
End
Begin PaneConfiguration = 3
NumPanes = 3
Configuration = "(H (4 [30] 2 [40] 3))"
End
Begin PaneConfiguration = 4
NumPanes = 2
Configuration = "(H (1 [56] 3))"
End
Begin PaneConfiguration = 5
NumPanes = 2
Configuration = "(H (2 [66] 3))"
End
Begin PaneConfiguration = 6
NumPanes = 2
Configuration = "(H (4 [50] 3))"
End
Begin PaneConfiguration = 7
NumPanes = 1
Configuration = "(V (3))"
End
Begin PaneConfiguration = 8
NumPanes = 3
Configuration = "(H (1[56] 4[18] 2) )"
End
Begin PaneConfiguration = 9
NumPanes = 2
Configuration = "(H (1 [75] 4))"
End
Begin PaneConfiguration = 10
NumPanes = 2
Configuration = "(H (1[66] 2) )"
End
Begin PaneConfiguration = 11
NumPanes = 2
Configuration = "(H (4 [60] 2))"
End
Begin PaneConfiguration = 12
NumPanes = 1
Configuration = "(H (1) )"
End
Begin PaneConfiguration = 13
NumPanes = 1
Configuration = "(V (4))"
End
Begin PaneConfiguration = 14
NumPanes = 1
Configuration = "(V (2))"
End
ActivePaneConfig = 0
End
Begin DiagramPane =
Begin Origin =
Top = 0
Left = 0
End
Begin Tables =
Begin Table = "ListValues"
Begin Extent =
Top = 6
Left = 38
Bottom = 187
Right = 208
End
DisplayFlags = 280
TopColumn = 0
End
End
End
Begin SQLPane =
End
Begin DataPane =
Begin ParameterDefaults = ""
End
Begin ColumnWidths = 9
Width = 284
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
Width = 1500
End
End
Begin CriteriaPane =
Begin ColumnWidths = 11
Column = 1440
Alias = 900
Table = 1170
Output = 720
Append = 1400
NewValue = 1170
SortType = 1350
SortOrder = 1410
GroupBy = 1350
Filter = 1350
Or = 1350
Or = 1350
Or = 1350
End
End
End
', 'SCHEMA', 'dbo', 'VIEW', 'v_selPageSize';
go
exec sp_addextendedproperty 'MS_DiagramPaneCount', 1, 'SCHEMA', 'dbo', 'VIEW', 'v_selPageSize';
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(325, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
+289
View File
@@ -0,0 +1,289 @@
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/*----------------------------------
* Trigger su insert/update
*
* Aggiorna giustificativi nella tab TimbratureExpl
*
* creato da: S.E. Locatelli - 2012.12.04
* ultima modifica:
*----------------------------------*/
alter TRIGGER trg_giustUpdateTimbr
ON Giustificativi
FOR INSERT, UPDATE
AS
-- controllo se rescord esista altrimenti lo creo!!!
DECLARE @trovate INT = 0
DECLARE @idxDipendente INT
DECLARE @dataRif DATETIME
-- carico dati
SET @trovate = ISNULL( ( SELECT COUNT(*) FROM TimbratureExpl te INNER JOIN inserted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav) ,0)
SELECT @idxDipendente = idxDipendente, @dataRif=dataLav FROM inserted
IF(@trovate = 0)
BEGIN
EXEC stp_ricalcolaTimbratureExpl @idxDipendente, @dataRif
END
-- CONTROLLO SE IL RECORD NON SIA BLOCCATO con where nell'update
-- prendo tutte le "vecchie" righe (deleted) e x le giornate relative TOLGO i minuti dei giustificativi
UPDATE TimbratureExpl
SET minMal = CASE WHEN g.codGiust='MAL' THEN 0 ELSE minMal END,
minFer = CASE WHEN g.codGiust='FER' THEN 0 ELSE minFer END,
minFest = CASE WHEN g.codGiust='FEST' THEN 0 ELSE minFest END,
minPerm = CASE WHEN g.codGiust='PERM' THEN 0 ELSE minPerm END
FROM TimbratureExpl te INNER JOIN deleted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav
WHERE te.block = 0
-- prendo le "nuove" righe (inserted) e x le giornate relative AGGIUNGO i minuti dei giustificativi
UPDATE TimbratureExpl
SET minMal = CASE WHEN g.codGiust='MAL' THEN g.minuti ELSE minMal END,
minFer = CASE WHEN g.codGiust='FER' THEN g.minuti ELSE minFer END,
minFest = CASE WHEN g.codGiust='FEST' THEN g.minuti ELSE minFest END,
minPerm = CASE WHEN g.codGiust='PERM' THEN g.minuti ELSE minPerm END
FROM TimbratureExpl te INNER JOIN inserted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav
WHERE te.block = 0
-- verifico SE codice orario richieda una chkFun eseguo calcolo...
IF(dbo.f_chkFunDip(@idxDipendente)<>'')
BEGIN
EXEC stp_TE_doChkFun @idxDipendente, @dataRif
END
go
/*----------------------------------
* Trigger su delete
*
* Aggiorna giustificativi nella tab TimbratureExpl
*
* creato da: S.E. Locatelli - 2012.12.04
* ultima modifica:
*----------------------------------*/
alter TRIGGER trg_giustDelUpdTimbr
ON Giustificativi
FOR DELETE
AS
-- controllo se rescord esista altrimenti lo creo!!!
DECLARE @trovate INT = 0
DECLARE @idxDipendente INT
DECLARE @dataRif DATETIME
-- carico dati
SELECT @idxDipendente = idxDipendente, @dataRif=dataLav FROM deleted
-- CONTROLLO SE IL RECORD NON SIA BLOCCATO in update con where
-- prendo tutte le "vecchie" righe (deleted) e x le giornate relative TOLGO i minuti dei giustificativi
UPDATE TimbratureExpl
SET minMal = CASE WHEN g.codGiust='MAL' THEN 0 ELSE minMal END,
minFer = CASE WHEN g.codGiust='FER' THEN 0 ELSE minFer END,
minFest = CASE WHEN g.codGiust='FEST' THEN 0 ELSE minFest END,
minPerm = CASE WHEN g.codGiust='PERM' THEN 0 ELSE minPerm END
FROM TimbratureExpl te INNER JOIN deleted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav
WHERE te.block = 0
-- verifico SE codice orario richieda una chkFun eseguo calcolo...
IF(dbo.f_chkFunDip(@idxDipendente)<>'')
BEGIN
EXEC stp_TE_doChkFun @idxDipendente, @dataRif
END
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/*************************************************
* STORED PROCEDURE stp_giust_insertQuery
*
* Aggiunge un giustificativo NUOVO
* mod: S.E.L. - 2013.04.03
**************************************************/
create PROCEDURE stp_giust_insertQuery
(
@dataLav date,
@idxDipendente int,
@codGiust nvarchar(5),
@minuti int
)
AS
INSERT INTO Giustificativi (dataLav, idxDipendente, codGiust, minuti)
VALUES (@dataLav, @idxDipendente, @codGiust, @minuti)
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/*************************************************
* STORED PROCEDURE stp_giust_insByDate
*
* Aggiunge un giustificativo per coprire la durata necessaria a chiudere la giornata indicata
* mod: S.E.L. - 2012.12.10
**************************************************/
alter PROCEDURE stp_giust_insByDate
(
@idxDipendente INT = 0,
@dataRif DATETIME,
@codGiust NVARCHAR(5) = 'PERM'
)
AS
BEGIN TRAN
DECLARE @minPerm INT = 0 -- min necessari x chiudere giornata
DECLARE @isPP BIT = 0
SELECT @isPP = CASE WHEN ISNULL(chkFunCod,'')='P' THEN 1 ELSE 0 END FROM TimbratureExpl WHERE idxDipendente=@idxDipendente AND dataLav=@dataRif
IF(@isPP=1)
BEGIN
-- recupero tipo di fuction da usare
DECLARE @chkFun NVARCHAR(50) = ''
DECLARE @minPP INT = 0
-- imposto variabili
SELECT @chkFun = dbo.f_chkFunDip(@idxDipendente), @codGiust = 'PERM'
-- controllo tipo di funzione... e imposto risultato!
IF(@chkFun = 'PP60m')
BEGIN
SET @minPP = 60
END
ELSE IF(@chkFun = 'PP30m')
BEGIN
SET @minPP = 30
END
-- calcolo quota permesso
SELECT @minPerm = @minPP - (minArcoPres - minLav)
FROM TimbratureExpl
WHERE idxDipendente = @idxDipendente AND dataLav = @dataRif
-- INSERT giustificativo!
INSERT INTO Giustificativi
VALUES (@dataRif,@idxDipendente,@codGiust,@minPerm,1)
END
ELSE
BEGIN
-- variabili
DECLARE @minArr INT
--SELECT @minArr=dbo.f_minArrotDip(@idxDipendente)
SELECT @minArr = ISNULL(valInt,1) FROM AnagKeyValue WHERE nomeVar = 'minutiRoundDay'
-- calcolo minuti
SELECT @minPerm = (CEILING(CONVERT(FLOAT,minOrd-minLav)/@minArr)*@minArr)
FROM TimbratureExpl
WHERE isOkLav = 0
AND idxDipendente = @idxDipendente
AND dataLav = @dataRif
-- INSERT giustificativo!
INSERT INTO Giustificativi
VALUES (@dataRif,@idxDipendente,@codGiust,@minPerm,1)
END
COMMIT TRAN
RETURN
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/*******************************************************************************
* STORED PROCEDURE stp_TE_doChkFun
*
* effettua check finali sulla riga di timbrature esplore indicata, contiene varie logiche
* anche da + installazioni clienti
*
* mod: S.E.L. 2013.03.28
*
*******************************************************************************/
alter PROCEDURE stp_TE_doChkFun
(
@idxDipendente INT,
@dataRif DATETIME
)
AS
SET NOCOUNT ON;
-- recupero tipo di fuction da usare
DECLARE @chkFun NVARCHAR(50) = ''
DECLARE @chkFunCod NVARCHAR(50) = ''
DECLARE @chkFunRes NVARCHAR(50) = ''
DECLARE @minPP INT = 0
SELECT @chkFun = dbo.f_chkFunDip(@idxDipendente)
-- controllo tipo di funzione... e imposto risultato!
IF(@chkFun = 'PP60m')
BEGIN
SELECT @minPP = 60, @chkFunCod = 'P', @chkFunRes = 'Mancata pausa pranzo 60m'
END
ELSE IF(@chkFun = 'PP30m')
BEGIN
SELECT @minPP = 30, @chkFunCod = 'P', @chkFunRes = 'Mancata pausa pranzo 30m'
END
-- se c'è check da fare faccio COMUNQUE update!
IF(@chkFun <>'')
BEGIN
UPDATE TimbratureExpl
SET chkFunCod = CASE WHEN (minArcoPres - minLav) < @minPP - minPerm THEN @chkFunCod ELSE '' END, -- chk pause > PP imposta (- minuti permesso caricati)
chkFunRes = CASE WHEN (minArcoPres - minLav) < @minPP - minPerm THEN @chkFunRes ELSE '' END -- chk pause > PP imposta (- minuti permesso caricati)
WHERE idxDipendente = @idxDipendente AND dataLav = @dataRif
AND (minOrd > 0 AND minLav > 0) -- controllo DEBBA lavorare e ABBIA lavorato
AND block = 0 -- controllo NON sia bloccato
END
RETURN
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(327, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
+417
View File
@@ -0,0 +1,417 @@
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/*----------------------------------
* Trigger su insert/update
*
* Aggiorna giustificativi nella tab TimbratureExpl
*
* creato da: S.E. Locatelli - 2012.12.04
* ultima modifica:
*----------------------------------*/
alter TRIGGER trg_giustUpdateTimbr
ON Giustificativi
FOR INSERT, UPDATE
AS
-- controllo se rescord esista altrimenti lo creo!!!
DECLARE @trovate INT = 0
DECLARE @idxDipendente INT
DECLARE @dataRif DATETIME
-- carico dati
SET @trovate = ISNULL( ( SELECT COUNT(*) FROM TimbratureExpl te INNER JOIN inserted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav) ,0)
SELECT @idxDipendente = idxDipendente, @dataRif=dataLav FROM inserted
IF(@trovate = 0)
BEGIN
EXEC stp_ricalcolaTimbratureExpl @idxDipendente, @dataRif
END
-- CONTROLLO SE IL RECORD NON SIA BLOCCATO con where nell'update
-- prendo tutte le "vecchie" righe (deleted) e x le giornate relative TOLGO i minuti dei giustificativi
UPDATE TimbratureExpl
SET minMal = CASE WHEN g.codGiust IN('MAL','MAT','INF') THEN 0 ELSE minMal END,
minFer = CASE WHEN g.codGiust='FER' THEN 0 ELSE minFer END,
minFest = CASE WHEN g.codGiust='FEST' THEN 0 ELSE minFest END,
minPerm = CASE WHEN g.codGiust='PERM' THEN 0 ELSE minPerm END
FROM TimbratureExpl te INNER JOIN deleted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav
WHERE te.block = 0
-- prendo le "nuove" righe (inserted) e x le giornate relative AGGIUNGO i minuti dei giustificativi
UPDATE TimbratureExpl
SET minMal = CASE WHEN g.codGiust IN('MAL','MAT','INF') THEN g.minuti ELSE minMal END,
minFer = CASE WHEN g.codGiust='FER' THEN g.minuti ELSE minFer END,
minFest = CASE WHEN g.codGiust='FEST' THEN g.minuti ELSE minFest END,
minPerm = CASE WHEN g.codGiust='PERM' THEN g.minuti ELSE minPerm END
FROM TimbratureExpl te INNER JOIN inserted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav
WHERE te.block = 0
-- verifico SE codice orario richieda una chkFun eseguo calcolo...
IF(dbo.f_chkFunDip(@idxDipendente)<>'')
BEGIN
EXEC stp_TE_doChkFun @idxDipendente, @dataRif
END
go
/*----------------------------------
* Trigger su delete
*
* Aggiorna giustificativi nella tab TimbratureExpl
*
* creato da: S.E. Locatelli - 2012.12.04
* ultima modifica:
*----------------------------------*/
alter TRIGGER trg_giustDelUpdTimbr
ON Giustificativi
FOR DELETE
AS
-- controllo se rescord esista altrimenti lo creo!!!
DECLARE @trovate INT = 0
DECLARE @idxDipendente INT
DECLARE @dataRif DATETIME
-- carico dati
SELECT @idxDipendente = idxDipendente, @dataRif=dataLav FROM deleted
-- CONTROLLO SE IL RECORD NON SIA BLOCCATO in update con where
-- prendo tutte le "vecchie" righe (deleted) e x le giornate relative TOLGO i minuti dei giustificativi
UPDATE TimbratureExpl
SET minMal = CASE WHEN g.codGiust IN('MAL','MAT','INF') THEN 0 ELSE minMal END,
minFer = CASE WHEN g.codGiust='FER' THEN 0 ELSE minFer END,
minFest = CASE WHEN g.codGiust='FEST' THEN 0 ELSE minFest END,
minPerm = CASE WHEN g.codGiust='PERM' THEN 0 ELSE minPerm END
FROM TimbratureExpl te INNER JOIN deleted g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav
WHERE te.block = 0
-- verifico SE codice orario richieda una chkFun eseguo calcolo...
IF(dbo.f_chkFunDip(@idxDipendente)<>'')
BEGIN
EXEC stp_TE_doChkFun @idxDipendente, @dataRif
END
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/*******************************************************************************
* stp_ricalcolaTimbratureExpl
*
* Aggiorna la tab timbrature expl ricalcolando la giornata del record interessato
* mod: S.E.L. - 2012.02.06
********************************************************************************/
alter PROCEDURE stp_ricalcolaTimbratureExpl
(
@idxDipendente AS INT,
@dataRif AS DATETIME
)
AS
-- variabili
DECLARE @minArr INT
SELECT @minArr=dbo.f_minArrotDip(@idxDipendente)
-- CONTROLLO SE IL RECORD NON SIA BLOCCATO!!!
DECLARE @block BIT
SET @block = ( SELECT ISNULL(( SELECT block FROM TimbratureExpl WHERE (idxDipendente = @idxDipendente) AND CONVERT(DATE,dataLav) = CONVERT(DATE,@dataRif) ),0) )
IF(@block = 0)
BEGIN
-- elimino i periodi della data indicata...
DELETE FROM TimbratureExpl
WHERE (idxDipendente = @idxDipendente) AND CONVERT(DATE,dataLav) = CONVERT(DATE,@dataRif)
-- inserisco i dati minimi per la data indicata
INSERT INTO TimbratureExpl(idxDipendente, dataLav)
VALUES(@idxDipendente, CONVERT(DATE,@dataRif))
-- aggiorno cognome nome
BEGIN TRY
UPDATE te
SET CognomeNome = ISNULL(vcn.CognomeNome,'')
FROM TimbratureExpl te INNER JOIN v_cognomeNome vcn ON te.idxDipendente = vcn.idxDipendente
WHERE CONVERT(DATE,te.dataLav) = CONVERT(DATE,@dataRif) AND te.idxDipendente = @idxDipendente
END TRY
BEGIN CATCH
-- non faccio nulla
END CATCH
-- aggiorno 1° timbratura
UPDATE te
SET te.entrata_1 = pl.entrata,
te.uscita_1 = pl.uscita
FROM TimbratureExpl te INNER JOIN PeriodiLav pl ON
te.idxDipendente = pl.idxDipendente AND
(CONVERT(DATE,te.dataLav) = CONVERT(DATE,pl.entrata))
WHERE pl.rowNum = 1 AND te.idxDipendente = @idxDipendente AND CONVERT(DATE,pl.entrata) = CONVERT(DATE,@dataRif)
-- aggiorno 2° timbratura
UPDATE te
SET te.entrata_2 = pl.entrata,
te.uscita_2 = pl.uscita
FROM TimbratureExpl te INNER JOIN PeriodiLav pl ON te.idxDipendente = pl.idxDipendente
AND (CONVERT(DATE,te.dataLav) = CONVERT(DATE,pl.entrata))
WHERE pl.rowNum = 2 AND te.idxDipendente = @idxDipendente AND CONVERT(DATE,pl.entrata) = CONVERT(DATE,@dataRif)
-- aggiorno 3° timbratura
UPDATE te
SET te.entrata_3 = pl.entrata,
te.uscita_3 = pl.uscita
FROM TimbratureExpl te INNER JOIN PeriodiLav pl ON te.idxDipendente = pl.idxDipendente
AND (CONVERT(DATE,te.dataLav) =CONVERT(DATE,pl.entrata))
WHERE pl.rowNum = 3 AND te.idxDipendente = @idxDipendente AND CONVERT(DATE,pl.entrata) = CONVERT(DATE,@dataRif)
-- aggiorno 4° timbratura
UPDATE te
SET te.entrata_4 = pl.entrata,
te.uscita_4 = pl.uscita
FROM TimbratureExpl te INNER JOIN PeriodiLav pl ON te.idxDipendente = pl.idxDipendente
AND (CONVERT(DATE,te.dataLav) =CONVERT(DATE,pl.entrata))
WHERE pl.rowNum = 4 AND te.idxDipendente = @idxDipendente AND CONVERT(DATE,pl.entrata) = CONVERT(DATE,@dataRif)
-- calcolo ore totali...
UPDATE TimbratureExpl
SET h_lav = CAST(FLOOR((ISNULL(DATEDIFF(n,entrata_1,uscita_1),0) + ISNULL(DATEDIFF(n,entrata_2,uscita_2),0) + ISNULL(DATEDIFF(n,entrata_3,uscita_3),0) + ISNULL(DATEDIFF(n,entrata_4,uscita_4),0))/@minArr) AS FLOAT)*@minArr/60
FROM TimbratureExpl
WHERE (CONVERT(DATE,dataLav) = CONVERT(DATE,@dataRif)) AND idxDipendente = @idxDipendente
-- verifico: se c'è anche solo 1 timbratura non approvata metto flag isOkApp a falso
UPDATE TimbratureExpl
SET isOkApp = ISNULL((
SELECT MIN(CASE WHEN Approv=0 THEN 0 ELSE 1 END) AS isOk
FROM Timbrature
WHERE idxDipendente = @idxDipendente
AND (CONVERT(DATE,dataOra) = CONVERT(DATE,@dataRif))
GROUP BY CONVERT(DATE,dataOra)
),1)
FROM TimbratureExpl
WHERE (CONVERT(DATE,dataLav) = CONVERT(DATE,@dataRif)) AND idxDipendente = @idxDipendente
-- verifico: se entrate <> uscite flag isOkTim a falso
UPDATE TimbratureExpl
SET isOkTim = (
SELECT CASE WHEN
ISNULL(
(SELECT COUNT(*) as timb
FROM Timbrature AS t
WHERE t.idxDipendente = @idxDipendente
AND (CONVERT(DATE,dataOra) = CONVERT(DATE,@dataRif))
GROUP BY t.idxDipendente , CONVERT(DATE,t.dataOra)
HAVING COUNT ( CASE Entrata WHEN 1 THEN dataOra END ) <> COUNT ( CASE Entrata WHEN 0 THEN dataOra END )
),0) > 0 THEN 0 ELSE 1 END
)
FROM TimbratureExpl
WHERE (CONVERT(DATE,dataLav) = CONVERT(DATE,@dataRif)) AND idxDipendente = @idxDipendente
-- calcolo resoconto MINUTI giornaliero, imposto LUN x inizio settimana
SET DATEFIRST 1
-- MIN lavorati, ordinari (con arrotondamento...)
UPDATE TimbratureExpl
SET minLav = CAST((ISNULL(DATEDIFF(n,entrata_1,uscita_1),0) + ISNULL(DATEDIFF(n,entrata_2,uscita_2),0) + ISNULL(DATEDIFF(n,entrata_3,uscita_3),0) + ISNULL(DATEDIFF(n,entrata_4,uscita_4),0)) AS FLOAT)
,minOrd = dbo.f_oreOrdDip(idxDipendente,dataLav) * 60 -- da schema orario dip attivo
FROM TimbratureExpl
WHERE (CONVERT(DATE,dataLav) = CONVERT(DATE,@dataRif)) AND idxDipendente = @idxDipendente
-- MIN non lavorati, straordinari (con arrotondamento...)
UPDATE TimbratureExpl
SET minNonLav = (CEILING(CONVERT(FLOAT,CASE WHEN minOrd <= minLav THEN (0) ELSE minOrd-minLav END)/@minArr)*@minArr)
,minStra = (FLOOR(CONVERT(FLOAT,CASE WHEN minOrd < minLav AND minLav > (0) THEN minLav-minOrd ELSE (0) END)/@minArr)*@minArr)
FROM TimbratureExpl
WHERE (CONVERT(DATE,dataLav) = CONVERT(DATE,@dataRif)) AND idxDipendente = @idxDipendente
-- MIN da tab giustificativi (feste, ferie, malattia, permessi)
UPDATE TimbratureExpl
SET minMal = CASE WHEN g.codGiust IN('MAL','MAT','INF') THEN g.minuti ELSE minMal END,
minFer = CASE WHEN g.codGiust='FER' THEN g.minuti ELSE minFer END,
minFest = CASE WHEN g.codGiust='FEST' THEN g.minuti ELSE minFest END,
minPerm = CASE WHEN g.codGiust='PERM' THEN g.minuti ELSE minPerm END,
chkFunCod = '',
chkFunRes = ''
FROM TimbratureExpl te INNER JOIN Giustificativi g ON te.idxDipendente = g.idxDipendente AND te.dataLav = g.dataLav
WHERE (CONVERT(DATE,te.dataLav) = CONVERT(DATE,@dataRif)) AND te.idxDipendente = @idxDipendente
-- verifico SE codice orario richieda una chkFun eseguo calcolo...
IF(dbo.f_chkFunDip(@idxDipendente)<>'')
BEGIN
EXEC stp_TE_doChkFun @idxDipendente, @dataRif
END
END
RETURN
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/*************************************************
* STORED PROCEDURE stp_giust_insByDate
*
* Aggiunge un giustificativo per coprire la durata necessaria a chiudere la giornata indicata
* mod: S.E.L. - 2012.12.10
**************************************************/
alter PROCEDURE stp_giust_insByDate
(
@idxDipendente INT = 0,
@dataRif DATETIME,
@codGiust NVARCHAR(5) = 'PERM'
)
AS
BEGIN TRAN
DECLARE @minPerm INT = 0 -- min necessari x chiudere giornata
DECLARE @isPP BIT = 0
SELECT @isPP = CASE WHEN ISNULL(chkFunCod,'')='P' THEN 1 ELSE 0 END FROM TimbratureExpl WHERE idxDipendente=@idxDipendente AND dataLav=@dataRif
IF(@isPP=1)
BEGIN
-- recupero tipo di fuction da usare
DECLARE @chkFun NVARCHAR(50) = ''
DECLARE @minPP INT = 0
-- imposto variabili
SELECT @chkFun = dbo.f_chkFunDip(@idxDipendente), @codGiust = 'PERM'
-- controllo tipo di funzione... e imposto risultato!
/*
IF(@chkFun = 'PP60m')
BEGIN
SET @minPP = 60
END
ELSE IF(@chkFun = 'PP30m')
BEGIN
SET @minPP = 30
END
*/
IF(@chkFun LIKE 'PP%m')
BEGIN
SELECT @minPP=REPLACE(REPLACE(@chkFun,'PP',''),'m','')
END
-- calcolo quota permesso
SELECT @minPerm = @minPP - (minArcoPres - minLav)
FROM TimbratureExpl
WHERE idxDipendente = @idxDipendente AND dataLav = @dataRif
-- INSERT giustificativo!
INSERT INTO Giustificativi
VALUES (@dataRif,@idxDipendente,@codGiust,@minPerm,1)
END
ELSE
BEGIN
-- variabili
DECLARE @minArr INT
--SELECT @minArr=dbo.f_minArrotDip(@idxDipendente)
SELECT @minArr = ISNULL(valInt,1) FROM AnagKeyValue WHERE nomeVar = 'minutiRoundDay'
-- calcolo minuti
SELECT @minPerm = (CEILING(CONVERT(FLOAT,minOrd-minLav)/@minArr)*@minArr)
FROM TimbratureExpl
WHERE isOkLav = 0
AND idxDipendente = @idxDipendente
AND dataLav = @dataRif
-- INSERT giustificativo!
INSERT INTO Giustificativi
VALUES (@dataRif,@idxDipendente,@codGiust,@minPerm,1)
END
COMMIT TRAN
RETURN
go
/*******************************************************************************
* STORED PROCEDURE stp_TE_doChkFun
*
* effettua check finali sulla riga di timbrature esplore indicata, contiene varie logiche
* anche da + installazioni clienti
*
* mod: S.E.L. 2013.03.28
*
*******************************************************************************/
alter PROCEDURE stp_TE_doChkFun
(
@idxDipendente INT,
@dataRif DATETIME
)
AS
SET NOCOUNT ON;
-- recupero tipo di fuction da usare
DECLARE @chkFun NVARCHAR(50) = ''
DECLARE @chkFunCod NVARCHAR(50) = ''
DECLARE @chkFunRes NVARCHAR(50) = ''
DECLARE @minPP INT = 0
SELECT @chkFun = dbo.f_chkFunDip(@idxDipendente)
-- controllo tipo di funzione... e imposto risultato!
/*
IF(@chkFun = 'PP60m')
BEGIN
SELECT @minPP = 60, @chkFunCod = 'P', @chkFunRes = 'Mancata pausa pranzo 60m'
END
ELSE IF(@chkFun = 'PP30m')
BEGIN
SELECT @minPP = 30, @chkFunCod = 'P', @chkFunRes = 'Mancata pausa pranzo 30m'
END
*/
IF(@chkFun LIKE 'PP%m')
BEGIN
SELECT @minPP=REPLACE(REPLACE(@chkFun,'PP',''),'m',''), @chkFunCod = 'P'
SELECT @chkFunRes = 'Mancata pausa pranzo ' + CAST(@minPP AS NVARCHAR) + 'm'
END
-- se c'è check da fare faccio COMUNQUE update!
IF(@chkFun <>'')
BEGIN
UPDATE TimbratureExpl
SET chkFunCod = CASE WHEN (minArcoPres - minLav) < @minPP - minPerm THEN @chkFunCod ELSE '' END, -- chk pause > PP imposta (- minuti permesso caricati)
chkFunRes = CASE WHEN (minArcoPres - minLav) < @minPP - minPerm THEN @chkFunRes ELSE '' END -- chk pause > PP imposta (- minuti permesso caricati)
WHERE idxDipendente = @idxDipendente AND dataLav = @dataRif
AND (minOrd > 0 AND minLav > 0) -- controllo DEBBA lavorare e ABBIA lavorato
AND block = 0 -- controllo NON sia bloccato
END
RETURN
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(328, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
File diff suppressed because it is too large Load Diff
+69
View File
@@ -0,0 +1,69 @@
-- richiama update x sistemazione voci PERM --> MPP
BEGIN TRAN ;
WITH cte as (
SELECT g.dataLav
,g.idxDipendente
,codGiust
,minuti
,automatico
,dbo.f_chkFunDip(g.idxDipendente) AS chk
,dbo.f_chkFunDipMin(g.idxDipendente,g.dataLav,'MPP') AS minChk -- calcolo gli eventuali minuti MPP
,t.minArcoPres
,t.minLav
,t.minArcoPres-t.minLav as chkDiff
FROM dbo.Giustificativi AS g
LEFT JOIN TimbratureExpl AS t ON g.idxDipendente = t.idxDipendente AND g.dataLav = t.dataLav
WHERE codGiust = 'PERM'
AND minuti <= 60
AND dbo.f_chkFunDip(g.idxDipendente) <> ''
AND minuti = dbo.f_chkFunDipMin(g.idxDipendente,g.dataLav,'MPP')
)
UPDATE dbo.Giustificativi
SET codGiust = 'MPP'
FROM dbo.Giustificativi AS g
INNER JOIN cte ON g.idxDipendente = cte.idxDipendente
AND g.dataLav = cte.dataLav
AND g.codGiust = 'PERM'
AND g.minuti = cte.minuti
-- test
SELECT g.dataLav
,g.idxDipendente
,codGiust
,minuti
,automatico
,dbo.f_chkFunDip(g.idxDipendente)
,dbo.f_chkFunDipMin(g.idxDipendente,g.dataLav,'MPP') -- calcolo gli eventuali minuti MPP
,t.minArcoPres
,t.minLav
,t.minArcoPres-t.minLav
FROM dbo.Giustificativi AS g
LEFT JOIN TimbratureExpl AS t ON g.idxDipendente = t.idxDipendente AND g.dataLav = t.dataLav
WHERE codGiust = 'MPP'
AND minuti <= 60
AND dbo.f_chkFunDip(g.idxDipendente) <> ''
AND minuti = dbo.f_chkFunDipMin(g.idxDipendente,g.dataLav,'MPP')
COMMIT
-- ricalcolo giornate
DECLARE @RC int
DECLARE @idxDipendente int
DECLARE @inizio datetime
DECLARE @fine datetime
EXECUTE @RC = [dbo].[stp_ricalcolaTimbExpl_byPeriodoUser]
0
,'20130301'
,'20130501'
GO
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(330, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
File diff suppressed because it is too large Load Diff
+381
View File
@@ -0,0 +1,381 @@
set xact_abort on;
go
begin transaction;
go
alter table TimbratureExpl drop
constraint DF_TimbratureExpl_minOrd ,
constraint DF_TimbratureExpl_minLav ,
constraint DF_TimbratureExpl_minNonLav ,
constraint DF_TimbratureExpl_minStra ,
constraint DF_TimbratureExpl_minPerm ,
constraint DF_TimbratureExpl_minFer ,
constraint DF_TimbratureExpl_minMal ,
constraint DF_TimbratureExpl_minFest ,
constraint DF_TimbratureExpl_minMpp ,
constraint DF_TimbratureExpl_isOkTim ,
constraint DF_TimbratureExpl_chkFunRes ,
constraint DF_TimbratureExpl_chkFunCod ,
constraint DF_TimbratureExpl_block ,
constraint DF_TimbratureExpl_isOk ;
go
exec sp_rename 'PK_TimbratureExpl_1', 'tmp__PK_TimbratureExpl_1', 'OBJECT';
go
exec sp_rename 'TimbratureExpl', 'tmp__TimbratureExpl_0', 'OBJECT';
go
create table TimbratureExpl(
dataLav date not null,
idxDipendente int not null,
CognomeNome nvarchar(100),
entrata_1 datetime,
uscita_1 datetime,
entrata_2 datetime,
uscita_2 datetime,
entrata_3 datetime,
uscita_3 datetime,
entrata_4 datetime,
uscita_4 datetime,
h_lav float,
h_giust as (((((CONVERT([float],[minPerm],(0))+[minFer])+[minMal])+[minFest])+[minMpp])/(60)),
minLav int constraint DF_TimbratureExpl_minLav default ((0)),
minOrd int constraint DF_TimbratureExpl_minOrd default ((0)),
minNonLav int constraint DF_TimbratureExpl_minNonLav default ((0)),
minStra int constraint DF_TimbratureExpl_minStra default ((0)),
minPerm int constraint DF_TimbratureExpl_minPerm default ((0)),
minFer int not null constraint DF_TimbratureExpl_minFer default ((0)),
minMal int constraint DF_TimbratureExpl_minMal default ((0)),
minFest int constraint DF_TimbratureExpl_minFest default ((0)),
minMpp int constraint DF_TimbratureExpl_minMpp default ((0)),
minArcoPres as (datediff(minute,isnull([entrata_1],getdate()),isnull(isnull([uscita_4],isnull([uscita_3],isnull([uscita_2],isnull([uscita_1],[entrata_1])))),getdate()))),
isOkTim bit constraint DF_TimbratureExpl_isOkTim default ((0)),
isOkApp bit constraint DF_TimbratureExpl_isOk default ((1)),
isOkLav as (case when [minOrd]<=((((([minLav]+[minPerm])+[minFer])+[minMal])+[minFest])+[minMpp]) then (1) else (0) end),
isOk as (([isOkTim]&[isOkApp])&case when [minOrd]<=((((([minLav]+[minPerm])+[minFer])+[minMal])+[minFest])+[minMpp]) then (1) else (0) end),
block bit constraint DF_TimbratureExpl_block default ((0)),
chkFunCod nvarchar(50) constraint DF_TimbratureExpl_chkFunCod default (''),
chkFunRes nvarchar(50) constraint DF_TimbratureExpl_chkFunRes default (''),
constraint PK_TimbratureExpl_1 primary key(dataLav,idxDipendente)
);
go
create index ix_idxDip on TimbratureExpl(idxDipendente)
include(dataLav,CognomeNome,h_lav,minOrd,minStra,minPerm,minFer,block,isOkApp,isOkTim);
go
create index ix_TimbrExpl_CognomeNome_DataLav on TimbratureExpl(CognomeNome,dataLav);
go
exec sp_addextendedproperty 'MS_Description', 'totale ore giustificate', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'h_giust';
go
exec sp_addextendedproperty 'MS_Description', 'minuti non lavorati (ovvero se fatti meno di ordinari e senza giustificativi)', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'minNonLav';
go
exec sp_addextendedproperty 'MS_Description', 'DATEDIFF(n, ISNULL(entrata_1,GETDATE()), ISNULL(ISNULL(uscita_4,ISNULL(uscita_3,ISNULL(uscita_2,ISNULL(uscita_1,entrata_1)))),GETDATE()))', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'minArcoPres';
go
exec sp_addextendedproperty 'MS_Description', 'dato sintetico x indicare se TUTTE le timbrature componenti siano approvate', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'isOkApp';
go
exec sp_addextendedproperty 'MS_Description', 'determina se la giornata sia ok (oreLav + giustificativi >= oreOrd)', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'isOkLav';
go
exec sp_addextendedproperty 'MS_Description', 'determina se il record sia "bloccato" (archiviazione e blocco mesi precedenti...)', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'block';
go
exec sp_addextendedproperty 'MS_Description', 'eventuale diagnostica da check function sulla riga indicata (codice)', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'chkFunCod';
go
exec sp_addextendedproperty 'MS_Description', 'eventuale diagnostica da check function sulla riga indicata (spiegazione)', 'SCHEMA', 'dbo', 'TABLE', 'TimbratureExpl', 'COLUMN', 'chkFunRes';
go
insert into TimbratureExpl(dataLav,idxDipendente,CognomeNome,entrata_1,uscita_1,entrata_2,uscita_2,entrata_3,uscita_3,entrata_4,uscita_4,h_lav,minLav,minOrd,minNonLav,minStra,minPerm,minFer,minMal,minFest,minMpp,isOkTim,isOkApp,block,chkFunCod,chkFunRes) select dataLav,idxDipendente,CognomeNome,entrata_1,uscita_1,entrata_2,uscita_2,entrata_3,uscita_3,entrata_4,uscita_4,h_lav,minLav,minOrd,minNonLav,minStra,minPerm,minFer,minMal,minFest,minMpp,isOkTim,isOkApp,block,chkFunCod,chkFunRes from tmp__TimbratureExpl_0;
go
drop table tmp__TimbratureExpl_0;
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
alter PROCEDURE stp_giust_insByDate
(
@idxDipendente INT = 0,
@dataRif DATETIME,
@codGiust NVARCHAR(5) = 'PERM'
)
AS
-- =============================================
-- Description: QUANDO VIENE USATA ???
-- SE c'è anomalia MPP entra sempre in gestione anomalia MPP per prima cosa
-- =============================================
DECLARE @minPerm INT = 0 -- min necessari x chiudere giornata
DECLARE @isPP BIT = 0
SELECT @isPP = CASE WHEN ISNULL(chkFunCod,'')='P' THEN 1 ELSE 0 END
FROM TimbratureExpl WHERE idxDipendente=@idxDipendente AND dataLav=@dataRif
BEGIN TRAN -- ???? MA SERVE ???
IF(@isPP=1) -- se carico mancata pausa pranzo
BEGIN
-- recupero tipo di fuction da usare
DECLARE @chkFun NVARCHAR(50) = ''
DECLARE @minPP INT = 0
-- imposto variabili
SELECT @chkFun = dbo.f_chkFunDip(@idxDipendente), @codGiust = 'MPP' -- mancata pausa pranzo
-- controllo tipo di funzione... e imposto risultato!
/*
IF(@chkFun = 'PP60m')
BEGIN
SET @minPP = 60
END
ELSE IF(@chkFun = 'PP30m')
BEGIN
SET @minPP = 30
END
*/
IF(@chkFun LIKE 'PP%m')
BEGIN
SELECT @minPP=REPLACE(REPLACE(@chkFun,'PP',''),'m','')
END
-- calcolo quota permesso
SELECT @minPerm = @minPP - (minArcoPres - minLav )
FROM TimbratureExpl
WHERE idxDipendente = @idxDipendente AND dataLav = @dataRif
-- INSERT giustificativo mancata pausa pranzo
INSERT INTO Giustificativi
VALUES (@dataRif,@idxDipendente,@codGiust,@minPerm,1)
END
ELSE
BEGIN
-- variabili
DECLARE @minArr INT
--SELECT @minArr=dbo.f_minArrotDip(@idxDipendente)
SELECT @minArr = ISNULL(valInt,1) FROM AnagKeyValue WHERE nomeVar = 'minutiRoundDay'
-- calcolo minuti
SELECT @minPerm = (CEILING(CONVERT(FLOAT,minOrd-minLav)/@minArr)*@minArr)-minMpp
FROM TimbratureExpl
WHERE isOkLav = 0
AND idxDipendente = @idxDipendente
AND dataLav = @dataRif
-- INSERT giustificativo!
INSERT INTO Giustificativi
VALUES (@dataRif,@idxDipendente,@codGiust,@minPerm,1)
END
COMMIT TRAN
RETURN
go
commit;
go
set ANSI_NULLS on;
go
/******************************************************************************
* Function f_oreFestDip
* calcola ore festività dipendente x data
*
* ATTENZIONE: si suppone valga default a lunedì cioé SET DATEFIRST 1
*
* mod: S.E.L. 2013.05.08
*
*******************************************************************************/
create FUNCTION f_oreFestDip
(
@idxDipendente INT,
@dataRif DATETIME
)
RETURNS FLOAT
AS
BEGIN
DECLARE @oreFerie FLOAT = 0
DECLARE @trovato INT = 0
-- controllo se sia un giorno nel calendario ferie...
SET @trovato = ( SELECT ISNULL(COUNT(*),0) FROM CalendFesteFerie WHERE data = @dataRif AND CodGiust='FEST' )
IF(@trovato > 0)
BEGIN
SET @oreFerie = dbo.f_oreOrdDip(@idxDipendente, @dataRif)
END
RETURN @oreFerie
END
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/******************************************************************************
* Function f_oreFerieDip
* calcola ore FERIE dipendente x data
*
* ATTENZIONE: si suppone valga default a lunedì cioé SET DATEFIRST 1
*
* mod: S.E.L. 2012.11.21
*
*******************************************************************************/
alter FUNCTION f_oreFerieDip
(
@idxDipendente INT,
@dataRif DATETIME
)
RETURNS FLOAT
AS
BEGIN
DECLARE @oreFerie FLOAT = 0
DECLARE @trovato INT = 0
-- controllo se sia un giorno nel calendario ferie...
SET @trovato = ( SELECT ISNULL(COUNT(*),0) FROM CalendFesteFerie WHERE data = @dataRif AND CodGiust='FER' )
IF(@trovato > 0)
BEGIN
SET @oreFerie = dbo.f_oreOrdDip(@idxDipendente, @dataRif)
END
RETURN @oreFerie
END
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_timbratureExplFillDate
*
* inserisce nelle TimbratureExpl le date mancanti x ogni dipendente, dato il mese indicato (fino a max data corrente...)
*
* mod: S.E.L. 2012.11.21
*
**********************************************************/
alter PROCEDURE stp_timbratureExplFillDate
(
@inizio DATETIME,
@fine DATETIME
)
AS
SET DATEFIRST 1
-- quanti giorni mi servono? conto giorni del mese
DECLARE @numD INT
SET @numD = ( SELECT DATEDIFF(dd, @inizio, @fine) )
-- elenco delle date DEL MESE (compresi sab/dom) fino a max data odierna
;WITH myCTE AS
(
SELECT CONVERT(DATE,DATEADD(dd, (N-1), @inizio)) as Data, idxDipendente, Cognome + ' ' + Nome + ' [' + Matricola + ']' as CognomeNome
FROM Tally, Dipendenti
WHERE N <= @numD
)
-- INSERISCO le mancanti con i min da lavorare da tab orari x ogni dipendente e le festività
INSERT INTO TimbratureExpl(dataLav, idxDipendente, CognomeNome, h_lav, minOrd, minFer, minFest, isOkTim)
SELECT mc.Data, mc.idxDipendente, mc.CognomeNome, 0, dbo.f_oreOrdDip(mc.idxDipendente,mc.Data) * 60, dbo.f_oreFerieDip(mc.idxDipendente,mc.Data) * 60, dbo.f_oreFestDip(mc.idxDipendente,mc.Data) * 60, 1
FROM myCte as mc LEFT OUTER JOIN TimbratureExpl te
ON mc.idxDipendente=te.idxDipendente AND mc.Data = te.dataLav
WHERE te.dataLav IS NULL
RETURN
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
------------------------------------------------------------------------
-- stp_timbratureExpl_getContinuato
--
-- Recupera la tab timbrature expl filtrando per anomalie di MANCATA PAUSA PRANZO (continuato)
-- mod: S.E.L. - 2013..05.08
------------------------------------------------------------------------
create PROCEDURE stp_timbratureExpl_getContinuato
(
@idxDipendente INT = 0, -- 0 = tutti
@inizio DATETIME,
@fine DATETIME
)
AS
SELECT *
FROM TimbratureExpl
WHERE (idxDipendente = @idxDipendente OR @idxDipendente = 0)
AND ((dataLav >= @inizio) AND (dataLav <= @fine))
AND isOkTim = 1 -- IN == OUT
AND (NOT (entrata_1 IS NULL) AND (entrata_2 IS NULL)) --entrata_1 ed uscita_1 ci sono, le altre no --> continuato!
AND minOrd > 240 -- orario con + di 4 ore sul giorno!
AND chkFunCod ='P'
AND (minPerm + minFer + minFest + minMPP) = 0 -- non ci sono compensazioni Mancata Pausa Pranzo
ORDER BY dataLav DESC
RETURN
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(333, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
File diff suppressed because it is too large Load Diff
+173
View File
@@ -0,0 +1,173 @@
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/*----------------------------------
* stp_ricalcolaRegAttivitaExpl_byPeriodoUser
*
* Ricalcola le RegAttivitaExpl x utente e intervallo date
* mod: S.E.L. - 2013.01.21
*----------------------------------*/
alter PROCEDURE stp_ricalcolaRegAttivitaExpl_byPeriodoUser
(
@idxDipendente INT = 0,
@inizio DATETIME,
@fine DATETIME
)
AS
-- dichiaro variabili x calcolo tempo execuzione e num records!
DECLARE @startProc DATETIME = GETDATE()
DECLARE @totRecords INT = 0
BEGIN
-- faccio una tab temporanea con tallyTable x calcolo periodo intero...
DECLARE @numD INT
SET @numD = ( SELECT DATEDIFF(dd, @inizio, @fine ) )
-- crea eventuali record mancanti: data, dip, cognome-nome
INSERT INTO RegAttivitaExpl(dataLav, idxDipendente)
SELECT ty.Data, ty.idxDipendente
FROM (
SELECT CONVERT(DATE,DATEADD(dd, -N, @fine)) as Data, idxDipendente
FROM Tally, Dipendenti
WHERE N <= @numD -- solo dati desiderati
AND (idxDipendente = @idxDipendente OR @idxDipendente = 0) --filtro su dipendenti
) ty LEFT OUTER JOIN RegAttivitaExpl rae ON ty.Data=rae.dataLav AND ty.idxDipendente=rae.idxDipendente
WHERE rae.dataLav IS NULL -- righe mancanti!
-- resetto a zero le eventuali righe che non hanno attività registrate
UPDATE rae
SET minRegAtt = 0
,descrProj = ''
FROM RegAttivitaExpl rae
LEFT OUTER JOIN (
SELECT DISTINCT idxDipendente, CONVERT(DATE,inizio) AS data
FROM dbo.RegAttivita
WHERE (idxDipendente = @idxDipendente OR @idxDipendente = 0) AND (inizio >= DATEADD(DAY,-1,@inizio) AND inizio <= @fine)
GROUP BY idxDipendente, CONVERT(DATE,inizio)
) vra ON rae.dataLav = vra.data AND rae.idxDipendente=vra.idxDipendente
WHERE vra.data IS NULL -- righe mancanti!
AND ((rae.idxDipendente = @idxDipendente OR @idxDipendente = 0) AND (rae.dataLav >= @inizio AND rae.dataLav < @fine)) -- solo x dip e periodo selezionati
-- tab temp del record date progetti
;WITH myCteRA AS(
SELECT idxDipendente, CONVERT(DATE,inizio) AS data, SUM(oreTot) AS oreTot, SUM(dbo.f_minuteInterval(inizio, fine)) as minTot, dbo.f_ProgettiByDate(idxDipendente, CONVERT(DATE,inizio)) AS progetti
FROM dbo.RegAttivita
WHERE (idxDipendente = @idxDipendente OR @idxDipendente = 0) AND (inizio >= DATEADD(DAY,-1,@inizio) AND inizio <= @fine)
GROUP BY idxDipendente, CONVERT(DATE,inizio)
)
-- aggiorno la tab delle RegAttivitaExpl
UPDATE rae
SET minRegAtt = minTot
,descrProj = ISNULL(progetti,'')
FROM RegAttivitaExpl rae
INNER JOIN myCteRA vra ON rae.dataLav = vra.data AND rae.idxDipendente=vra.idxDipendente
-- aggiorno cognome nome
BEGIN TRY
UPDATE rae
SET CognomeNome = ISNULL(vcn.CognomeNome,'')
FROM RegAttivitaExpl rae INNER JOIN v_cognomeNome vcn ON rae.idxDipendente = vcn.idxDipendente
WHERE ISNULL(rae.CognomeNome,'') = ''
END TRY
BEGIN CATCH
-- non faccio nulla
END CATCH
END
--SELECT @numD = @numD * COUNT(*) FROM Dipendenti WHERE (idxDipendente = @idxDipendente OR @idxDipendente = 0)
--SELECT @startProc AS startTime, GETDATE() AS endTime, @numD AS numRec, DATEDIFF(ms, @startProc, GETDATE()) AS totMs, CAST(@numD AS FLOAT) * 1000 / DATEDIFF(ms, @startProc, GETDATE()) AS recPerSec
RETURN
go
commit;
go
create table RegistroEventi(
DataOra datetime not null,
evento nvarchar(50) not null,
commento nvarchar(250),
constraint PK_RegistroEventi primary key(DataOra,evento)
);
go
set xact_abort on
go
begin transaction
go
INSERT INTO dbo.RegistroEventi
VALUES ('2013-06-10 12:21:52.250', N'checkAnomalie', N'-')
INSERT INTO dbo.RegistroEventi
VALUES ('2013-06-10 12:21:52.250', N'dailyDuties', N'-')
go
commit transaction
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_RE_GetByDataEv
*
* recupera dati da registro eventi x data ed evento
*
* mod: S.E.L. 2012.10.29
*
**********************************************************/
create PROCEDURE stp_RE_GetByDataEv
(
@evento NVARCHAR(50),
@data AS DATE
)
AS
SELECT *
FROM RegistroEventi
WHERE (evento = @evento) AND (CAST(ISNULL(DataOra, '1900-01-01') AS DATE) = @data)
RETURN
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(345, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
+346
View File
@@ -0,0 +1,346 @@
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
alter VIEW v_logCommUt
AS
SELECT dataLav AS Data, idxDipendente, CognomeNome, h_lav, 0.00 AS h_com, isOk AS okTimbr, isOk AS okLavCom, '---' AS progetto, minOrd, minStra, minPerm,
minFer, minMal, minFest, minMpp
FROM dbo.TimbratureExpl
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
-- =============================================
-- Author: G.Rottoli
-- Create date: 2013.03.12
-- Description: Stored per export x stampa di controllo tracciato paghe x ETS
-- =============================================
alter PROCEDURE export.stp_prt_orePagheMensileETS
(
@Anno NVARCHAR(4),
@Mese NVARCHAR(2),
@idxDipendente INT = 0, -- 0 = tutti
@flgOnlyErr BIT = 0,
@flgSingleUser BIT = 0 -- Stampa x singolo utente ( ritorna dati solo utente loggato SYSTEM_USER )
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @dateFrom AS SMALLDATETIME;
DECLARE @dateTo AS SMALLDATETIME;
SET @dateFrom = @Anno + @Mese + '01';
SET @dateTo = DATEADD( MM, 1, @dateFrom) -1;
EXEC export.stp_ricalcolaOrePerPaghe @dateFrom ;
SELECT
e.idxDipendente
, e.dataLav
, e.matricola
, e.codExt
, e.RifDitta
, e.oreStraordAss
, e.minLavStra
, e.minLavTot
, e.minStraProgrMese
, e.minPrevExp
, e.minLavOrdExp
, e.minStraExp
, e.minPermExp
, e.minFerieExp
, e.minMalExp
, e.minFestExp
, e.hhLavTotExp
, e.hhStraProgrMeseExp
, e.hhPrevExp
, e.hhLavOrdExp
, e.hhStraExp
, e.hhPermExp
, e.hhFerieExp
, e.hhMalExp
, e.hhFestExp
, e.CognomeNome
, e.entrata_1
, e.uscita_1
, e.entrata_2
, e.uscita_2
, e.entrata_3
, e.uscita_3
, e.entrata_4
, e.uscita_4
, e.isOkTim
, e.isOkApp
, e.isOkLav
, e.isOk
, e.block
, e.chkFunCod
, e.chkFunRes
, e.arrotMin
, e.gruppo
, e.exportEnab
--, e.h_ordinarie
--, e.h_lavorate
--, e.h_straordinarie
--, e.h_permessi
--, e.h_NonLavorati
--, e.h_ferie
--, e.h_malattia
--, e.h_festivita
--, e.mm_ordinari
--, e.mm_lavorati
--, e.mm_straordinari
--, e.mm_permessi
--, e.mm_NonLavorati
--, e.mm_ferie
--, e.mm_malattia
--, e.mm_festivita
--, e.minMpp
--, e.minLav
--, e.minOrd
--, e.minNonLav
--, e.minStra
--, e.minPerm
--, e.minFer
--, e.minMal
--, e.minFest
--, e.minArcoPres
--, e.h_lav
--, e.h_giust
FROM dbo.v_OreTimbratureDipendenteExport AS e
INNER JOIN dbo.Dipendenti AS dip
ON e.idxDipendente=dip.idxDipendente
AND ( dip.dominio + '\' + dip.utente = SYSTEM_USER OR @flgSingleUser = 0 )
WHERE datalav BETWEEN @dateFrom AND @dateTo
AND ( e.idxDipendente = @idxDipendente OR @idxDipendente = 0 OR @flgSingleUser = 1 )
AND ( @flgOnlyErr = 0 -- cmq tutti se @flgOnlyErr = False o solo quelli in errore NON USATO ( veto Sam )
OR isOk = 0 OR h_ordinarie > ( h_lavorate + h_ferie + h_permessi + h_festivita + h_malattia ) ) -- altrimenti quelle in errore
AND e.exportEnab = 1
END
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_lcuByDipDate
*
* elenco dati di timbratura e commessa per utente/periodo
*
* mod: S.E.L. 2012.11.02
*
**********************************************************/
alter PROCEDURE stp_lcuByDipDate
(
@idxDipendente INT,
@dataFrom DATETIME,
@dataTo DATETIME,
@maxErrMin INT = 0, -- minuti massimi di scostamento consentiti per DIFETTO, default 0
@maxErrPlus INT = 0 -- minuti massimi di scostamento consentiti per ECCESSO, default 0
)
with recompile
AS
BEGIN
-- faccio una tab temporanea con tallyTable x calcolo periodo intero...
DECLARE @numD INT
SET @numD = ( SELECT DATEDIFF(dd, @dataFrom, @dataTo ) )
-- tab dei record RegAttività progetti
;WITH myCteRA AS(
SELECT idxDipendente, dataLav, minRegAtt, descrProj
FROM dbo.RegAttivitaExpl
WHERE (idxDipendente = @idxDipendente OR @idxDipendente = 0) AND (dataLav >= DATEADD(DAY,-1,@dataFrom) AND dataLav <= @dataTo)
)
SELECT mc.Data, mc.idxDipendente, ISNULL(te.CognomeNome,'') AS CognomeNome, ISNULL(te.h_lav,0) AS h_lav, CAST(ISNULL(vra.minRegAtt,0) AS DECIMAL(9,3))/60 AS h_com
,ISNULL(te.isOk,0) AS okTimbr
,CASE WHEN ISNULL(vra.minRegAtt,0)-ISNULL(te.h_lav,0)*60 >= @maxErrMin AND ISNULL(vra.minRegAtt,0)-ISNULL(te.h_lav,0)*60 <= @maxErrPlus THEN 1 ELSE 0 END AS okLavCom
,ISNULL(vra.descrProj,'') AS progetti, ISNULL(te.minOrd,0) AS minOrd, ISNULL(te.minStra,0) AS minStra, ISNULL(te.minPerm,0) AS minPerm, ISNULL(te.minFer,0) AS minFer
,ISNULL(te.minMal,0) AS minMal, ISNULL(te.minFest,0) AS minFest, ISNULL(te.minMpp,0) AS minMpp
FROM (SELECT CONVERT(DATE,DATEADD(dd, -N, @dataTo)) as Data, idxDipendente
FROM Tally, Dipendenti
WHERE N <= @numD
AND (idxDipendente = @idxDipendente OR @idxDipendente = 0)
) AS mc
LEFT OUTER JOIN myCteRA vra ON mc.Data = vra.dataLav AND mc.idxDipendente=vra.idxDipendente
LEFT OUTER JOIN TimbratureExpl te ON mc.Data=te.dataLav AND te.idxDipendente=mc.idxDipendente
WHERE (te.idxDipendente = @idxDipendente OR @idxDipendente = 0)
ORDER BY mc.Data DESC
END
RETURN
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_RA_clonaLastRA_Utente
*
* clona un attività utente: se c'è da ultima altrimenti da zero x una certa data
*
* mod: S.E.L. 2013.01.17
*
**********************************************************/
alter PROCEDURE stp_RA_clonaLastRA_Utente
(
@idxDipendente INT,
@dataRif DATETIME, -- dataOra inizio record attività
@durataMin INT = 60 --durata in minuti (default 1 h)
)
AS
-- variabili
DECLARE @idxFase INT
DECLARE @idxRA INT
-- arrotondo data richiesta solo all'ora...
SELECT @dataRif = DATEADD(HOUR, DATEPART(HOUR,@dataRif), CONVERT(DATETIME,(CONVERT(DATE,@dataRif))))
-- cerco se esista ultima reg attività utente...
SELECT @idxRA = ISNULL((SELECT TOP 1 idxRA FROM RegAttivita WHERE idxDipendente = @idxDipendente ORDER BY inizio DESC),0)
-- se non ho trovato records, ovvero idxRA = 0, prendo ultima fase da elenco
IF (@idxRA = 0)
BEGIN
-- calcolo ultima fase inserita...
SELECT TOP 1 @idxFase=ISNULL(idxFase,0) FROM AnagFasi ORDER BY idxFase DESC
-- se trovata fase inserisco!
IF(@idxFase > 0)
BEGIN
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione, importo)
VALUES (@idxDipendente, @idxFase, @dataRif, DATEADD(MINUTE, @durataMin, @dataRif), '...',0)
END
END
ELSE
BEGIN
-- inserisco su data richiesta duplicazione dell'ultima attività utente...
INSERT INTO RegAttivita(idxDipendente, idxFase, inizio, fine, descrizione, importo)
SELECT idxDipendente, idxFase, @dataRif, CASE WHEN @durataMin > 0 THEN DATEADD(MINUTE, @durataMin, @dataRif) ELSE DATEADD(minute, DATEDIFF(MINUTE, inizio, fine), @dataRif) END, descrizione, importo
FROM RegAttivita
WHERE (idxRA = @idxRA)
END
go
commit;
go
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/*************************************
* STORED PROCEDURE stp_VSProjFasi_search
*
* dato un campo di ricerca va alla caddia del progetto e della fase che corrispondano
* Formati consentiti:
* - testo libero fase
* - formato commessa ETS full (xxxx-xxxx)
* - formato commessa ETS compatto (xx-xx)
*
* mod : 2013.07.04
* aut : S.E. Locatelli
**************************************/
create PROCEDURE stp_VSProjFasi_search
(
@textSearch NVARCHAR(50)
)
AS
DECLARE @codFase NVARCHAR(500)
SELECT @codFase = codFase
FROM AnagFasi
WHERE nomeFase LIKE '%' + @textSearch + '%' OR descrizioneFase LIKE '%' + @textSearch + '%'
AND Attivo = 1
AND EnableTime = 0
-- se non ha trovato nulal cerco anche in progetti... e prendo il primo progetto x nome/descrizione e da li la prima fase
IF(ISNULL(@codFase,'##################') ='##################')
BEGIN
SELECT @codFase = af.codFase
FROM AnagFasi af INNER JOIN AnagProgetti ap ON af.idxProgetto = ap.idxProgetto
WHERE ap.nomeProj LIKE '%' + @textSearch + '%' OR descrProj LIKE '%' + @textSearch + '%'
AND ap.Attivo = 1
AND af.Attivo = 1
AND EnableTime = 0
ORDER BY codFase DESC
END
SELECT TOP 1 idxProgetto, idxFase
FROM AnagFasi
WHERE codFase LIKE @codFase +'%'
AND Attivo = 1
AND EnableTime <> 0
ORDER BY codFase
RETURN
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(355, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
+74
View File
@@ -0,0 +1,74 @@
set xact_abort on;
go
begin transaction;
go
set ANSI_NULLS on;
go
/**********************************************************
* STORED stp_freqProjByDipPeriodo
*
* elenco dei progetti/fasi per dipendente/periodo
*
* mod: S.E.L. 2013.02.20
*
**********************************************************/
alter PROCEDURE stp_freqProjByDipPeriodo
(
@idxDipendente INT = 0, -- 0 = tutti
@inizio DATETIME,
@fine DATETIME,
@maxRes INT = 999 -- num max risultati desiderati
)
AS
-- calcolo il totale dei risultati per prima cosa...
DECLARE @totNum AS INT = 1
DECLARE @tabFreq AS TABLE
(
nomeProj NVARCHAR(250)
,nomeFase NVARCHAR(250)
,qty DECIMAL(9,3)
,idxFase INT
,idxFaseComm INT
)
INSERT @tabFreq
SELECT TOP (@maxRes) nomeProj, nomeFase ,SUM(ra.oreTot) as qty, ra.idxFase, af.idxFaseAncest
FROM RegAttivita ra INNER JOIN AnagFasi af ON ra.idxFase=af.idxFase
INNER JOIN AnagProgetti ap ON af.idxProgetto=ap.idxProgetto
WHERE ra.inizio BETWEEN @inizio AND @fine
AND (ra.idxDipendente = @idxDipendente OR @idxDipendente = 0 )
GROUP BY nomeProj, nomeFase, ra.idxFase, af.idxFaseAncest
ORDER BY qty DESC
-- calcolo il totale
SELECT @totNum = ISNULL(SUM(qty),1) FROM @tabFreq
;WITH myCTE AS
(
SELECT idxFaseComm, idxFase, nomeProj, nomeFase, qty/@totNum as freq, qty, @totNum AS tot
FROM @tabFreq
)
-- restituisco tab con calcolo freq reale
SELECT af.nomeFase as nomeComm, tf.*
FROM myCTE tf INNER JOIN AnagFasi af ON tf.idxFaseComm = af.idxFase
RETURN
go
commit;
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(359, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
@@ -0,0 +1,32 @@
set xact_abort on
go
begin transaction
go
INSERT INTO dbo.Vocabolario
VALUES (N'EN', N'SpostaOre', N'Spostamento Ore')
INSERT INTO dbo.Vocabolario
VALUES (N'EN', N'SpostaOreExpl', N'Visualizzazione e spostamento assegnazione ore tra progetti')
INSERT INTO dbo.Vocabolario
VALUES (N'IT', N'SpostaOre', N'Spostamento Ore')
INSERT INTO dbo.Vocabolario
VALUES (N'IT', N'SpostaOreExpl', N'Visualizzazione e spostamento assegnazione ore tra progetti')
go
commit transaction
go
-- registro versione...
INSERT INTO [dbo].[LogUpdateDb] ([Versione],[Data]) VALUES(304, GETDATE())
GO
SELECT * FROM LogUpdateDb ORDER BY Versione DESC
+162
View File
@@ -0,0 +1,162 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SteamWare;
namespace GPW_data
{
public class licenzeGPW
{
/// <summary>
/// numero di utenti attivi
/// </summary>
public static int utentiAttivi
{
get
{
int answ = DataProxy.DP.taDipendenti.getAttivi().Count;
return answ;
}
}
/// <summary>
/// numero di licenze attive sul sw (SE CONFORMI A CHIAVE) altrimenti da dll steamware
/// </summary>
public static int licenzeAttive
{
get
{
int answ = 0;
int licenzeMax = SteamWare.licenseMan.getLicenseNum(installazione, applicazione);
// verifico dato su DB sia valido... expiry date con quel numero sia > della data odierna!!!
if (scadenzaLicenza >= DateTime.Today)
{
answ = licenzeDb;
}
else
{
answ = licenzeMax;
}
return answ;
}
}
/// <summary>
/// numero di licenze attive su DB (NON verificate!)
/// </summary>
public static int licenzeDb
{
get
{
int answ = 0;
// controllo su db...
try
{
answ = DataProxy.DP.taAKV.getByKey(installazione)[0].valInt;
}
catch
{ }
return answ;
}
}
/// <summary>
/// chaive licenza
/// </summary>
public static string authKey
{
get
{
string answ = "";
// controllo su db...
try
{
answ = DataProxy.DP.taAKV.getByKey(installazione)[0].valString;
}
catch
{ }
return answ;
}
}
/// <summary>
/// nome installazione sw
/// </summary>
public static string installazione
{
get
{
string answ = "";
try
{
answ = DataProxy.DP.taAKV.getByKey("installazione")[0].valString;
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore recupero chiave installazione da AKV: {0}", exc), tipoLog.EXCEPTION);
}
return answ;
}
}
/// <summary>
/// modalità applicazione (pagina test.aspx)
/// </summary>
public static string modApp
{
get
{
string answ = "";
try
{
answ = DataProxy.DP.taAKV.getByKey("appMode")[0].valString;
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore recupero chiave appMode da AKV: {0}", exc), tipoLog.EXCEPTION);
}
return answ;
}
}
/// <summary>
/// nome applicazione sw
/// </summary>
public static string applicazione
{
get
{
string answ = memLayer.ML.confReadString("appName");
return answ;
}
}
/// <summary>
/// verifica se numero licenze copre utenti attivi...
/// </summary>
public static bool checkLicenze
{
get
{
bool answ = false;
try
{
answ = utentiAttivi <= licenzeAttive;
if (!answ && memLayer.ML.confReadInt("_logLevel") > 5)
{
logger.lg.scriviLog(string.Format("WARNING licenze: utenti attivi {0} / licenziati {1}", utentiAttivi, licenzeAttive), tipoLog.WARNING);
}
}
catch
{ }
return answ;
}
}
/// <summary>
/// scadenza licenze x applicativo
/// </summary>
public static DateTime scadenzaLicenza
{
get
{
DateTime answ = licenseMan.expiryDateByAuthKey(installazione, applicazione, DataProxy.DP.taAKV.getByKey(installazione)[0].valInt, DataProxy.DP.taAKV.getByKey(installazione)[0].valString);
return answ;
}
}
}
}
+75
View File
@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SteamWare;
namespace GPW_data
{
/// <summary>
/// classe di gestioen eventi timbratrice
/// </summary>
public class timbratrice
{
/// <summary>
/// registra una timbratura per il dipendente indicato
/// </summary>
/// <param name="idxDipendente"></param>
/// <param name="dataOra"></param>
/// <param name="isEntrata"></param>
/// <param name="ip"></param>
/// <param name="tipoTimbr"></param>
/// <param name="approvata"></param>
/// <returns></returns>
public static bool registraTimbratura(int idxDipendente, DateTime dataOra, bool isEntrata, string ip, string tipoTimbr, bool approvata)
{
bool answ = false;
try
{
DataProxy.DP.taTimb.stp_insTimbMan(idxDipendente, dataOra, isEntrata, ip, tipoTimbr, approvata);
answ = true;
}
catch
{ }
return answ;
}
/// <summary>
/// registra una timbratura per il dipendente indicato
/// </summary>
/// <param name="idxDipendente"></param>
/// <returns></returns>
public static bool nextIsEntrata(int idxDipendente)
{
bool answ = true;
try
{
// controllo dipendente
if (idxDipendente > 0)
{
// ricavo ultima timbratura..
DS_Applicazione.TimbratureRow rigaTimb = DataProxy.DP.taTimb.getLastByDip(idxDipendente)[0];
if (rigaTimb != null)
{
// calcolo vero valore
answ = !rigaTimb.entrata;
// controllo: se è la prima timbratura del giorno (cioé l'ultima è di ieri)
if (rigaTimb.dataOra.Date < DateTime.Now.Date)
{
// controllo: se è richiesto da config di forzare la prima ad entrata
if (memLayer.ML.confReadBool("firstIsIN"))
{
// --> indico che è COMUNQUE entrata
answ = true;
}
}
}
}
}
catch
{ }
return answ;
}
}
}
+376
View File
@@ -0,0 +1,376 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SteamWare;
namespace GPW_data
{
public class utils
{
/// <summary>
/// avvio oggetti utils
/// </summary>
protected utils()
{
setupElencoClienti();
}
/// <summary>
/// setup delle tabella elencoClienti
/// </summary>
protected void setupElencoClienti()
{
if (memLayer.ML.isInCacheObject("elencoClienti"))
{
elencoClienti = (Dictionary<string, string>)memLayer.ML.objCacheObj("elencoClienti");
}
else
{
elencoClienti = ricaricaElencoClienti();
memLayer.ML.setCacheVal("elencoClienti", elencoClienti, false);
}
}
/// <summary>
/// restituisce elenco clienti trasformato in dictionary
/// </summary>
/// <returns></returns>
protected Dictionary<string, string> ricaricaElencoClienti()
{
Dictionary<string, string> answ = new Dictionary<string, string>();
// recupero elenco clienti da dataproxy
foreach (DS_Applicazione.AnagClientiRow riga in DataProxy.DP.taAnCli.GetData())
{
answ.Add(riga.idxCliente.ToString(), riga.RagSociale);
}
return answ;
}
/// <summary>
/// singleton accesso metodo
/// </summary>
public static utils mng = new utils();
/// <summary>
/// dim pagina gridView in sessione
/// </summary>
public static int pageSize
{
get
{
int answ = 20;
try
{
answ = SteamWare.memLayer.ML.IntSessionObj("pageSize");
if (answ <= 0) answ = 20;
}
catch
{ }
return answ;
}
set
{
SteamWare.memLayer.ML.setSessionVal("pageSize", value);
}
}
/// <summary>
/// oggetto elenco clienti organizzato come dizionario con chiave idxCliente e valore la ragione sociale
/// </summary>
public Dictionary<string, string> elencoClienti;
/// <summary>
/// Effettua un insieme di controlli sulle anomalie delel timbrature/orari e invia le relative eventuali email
/// </summary>
/// <returns></returns>
public bool checkAnomalie()
{
bool answ = false;
try
{
// log richiesta!
logger.lg.scriviLog("Richiesto controllo anomalie!", tipoLog.INFO);
/*******************************************************
* controllo le varie anomalie delle timbrature:
*
* (A) mancate approvazioni --> admin
* (B) entrate <> uscite --> admin, user
* (C) mancata copertura orario --> admin
*
* (D) mancata copertura commesse (2 be done)
*
* recupero elenco dip interessati x le varie anomalie con stp_DipendentiAndAnomalie
* e poi da timbrExpl recupero le singole istanze di record errori
*
*******************************************************/
// setup valori base
string fromEmail = memLayer.ML.confReadString("_fromEmail");
string adminEmail = memLayer.ML.confReadString("adminAnomalieEmail");
string adminContinuatoEmail = memLayer.ML.confReadString("adminContinuatoEmail");
string adminOreLavEmail = memLayer.ML.confReadString("adminOreLavEmail");
string oggettoEmail = "";
string corpoEmail = "";
DS_Applicazione.stp_DipendentiAndAnomalieDataTable tabDipAndAnom = new DS_Applicazione.stp_DipendentiAndAnomalieDataTable();
DS_Applicazione.TimbratureExplDataTable tabTimbExpl = new DS_Applicazione.TimbratureExplDataTable();
DS_Applicazione.TE_RA_ExplDataTable tabTimbRegAtt = new DS_Applicazione.TE_RA_ExplDataTable();
DateTime adesso = DateTime.Now;
int gg2Chk = memLayer.ML.confReadInt("gg2Chk");
int gg2ChkCont = memLayer.ML.confReadInt("gg2ChkCont");
int gg2ChkOreCaricate = memLayer.ML.confReadInt("gg2ChkOreCaricate");
// (A) recupero mancate approvazioni, mando solo ad admin
if (memLayer.ML.confReadBool("checkAnomAppr"))
{
tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(0, adesso.AddDays(-gg2Chk), adesso.AddHours(1), true, false, false);
// se ho trovato record...
if (tabTimbExpl.Rows.Count > 0)
{
logger.lg.scriviLog("Trovate anomalie mancate approvazioni, invio email ad admin", tipoLog.INFO);
oggettoEmail = "Anomalie GPW: Approvazione Timbrature";
if (memLayer.ML.confReadBool("includeDirectUrl"))
{
corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:<br/><a href=\"{0}A1/approvTimbrature.aspx\">timbrature da approvare</a><br/><br/>", memLayer.ML.confReadString("baseUrl"));
}
else
{
corpoEmail = "Risultano a sistema le seguenti anomalie: timbrature da approvare<br/>";
}
corpoEmail += string.Format("{0}<br/>", SteamwareStrings.charLine('-', 80));
corpoEmail += "| -- DATA --\t| Dipendente<br/>";
corpoEmail += string.Format("{0}<br/>", SteamwareStrings.charLine('-', 80));
foreach (DS_Applicazione.TimbratureExplRow riga in tabTimbExpl)
{
corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}<br/>", riga.dataLav, riga.CognomeNome);
}
corpoEmail += SteamwareStrings.charLine('-', 80);
gestEmail.geAuth.mandaEmail(fromEmail, adminEmail, oggettoEmail, corpoEmail);
}
}
// (B) recupero errori entrate/uscite, mando ad admin + utenti
if (memLayer.ML.confReadBool("checkAnomTimb"))
{
tabDipAndAnom = DataProxy.DP.taDipAnom.GetData(adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, true, false);
tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(0, adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, true, false);
// se ho trovato record...
if (tabTimbExpl.Rows.Count > 0)
{
logger.lg.scriviLog("Trovate anomalie timbrature IN/OUT non corrispondenti, invio email!", tipoLog.INFO);
// mando email ad admin!
oggettoEmail = "Anomalie GPW: Timbrature mancanti";
if (memLayer.ML.confReadBool("includeDirectUrl"))
{
corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:<br/><a href=\"{0}A1/reviewTimbrature.aspx\">timbrature mancanti / non corrispondenti</a><br/><br/>", memLayer.ML.confReadString("baseUrl"));
}
else
{
corpoEmail = "Risultano a sistema le seguenti anomalie: timbrature mancanti<br/>";
}
corpoEmail += string.Format("{0}<br/>", SteamwareStrings.charLine('-', 80));
corpoEmail += "| -- DATA --\t| Dipendente<br/>";
corpoEmail += string.Format("{0}<br/>", SteamwareStrings.charLine('-', 80));
foreach (DS_Applicazione.TimbratureExplRow riga in tabTimbExpl)
{
corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}<br/>", riga.dataLav, riga.CognomeNome);
}
corpoEmail += SteamwareStrings.charLine('-', 80);
gestEmail.geAuth.mandaEmail(fromEmail, adminEmail, oggettoEmail, corpoEmail);
// re richiesto invio email utenti x warning entrate/uscrite
if (memLayer.ML.confReadBool("sendEmailToUser"))
{
// mando singole email ai dipendenti SE C'è EMAIL!!!!
foreach (DS_Applicazione.stp_DipendentiAndAnomalieRow rigaDip in tabDipAndAnom)
{
if (rigaDip.email != "")
{
tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(rigaDip.idxDipendente, adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, true, false);
// reimposto testo
if (memLayer.ML.confReadBool("includeDirectUrl"))
{
corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:<br/><a href=\"{0}A4/commesseUtente.aspx\">timbrature mancanti / non corrispondenti</a><br/><br/>", memLayer.ML.confReadString("baseUrl"));
}
else
{
corpoEmail = "Risultano a sistema le seguenti anomalie: timbrature mancanti / non corrispondenti<br/>";
}
corpoEmail += string.Format("{0}<br/>", SteamwareStrings.charLine('-', 80));
corpoEmail += "| -- DATA --\t| -- Dipendente --<br/>";
corpoEmail += string.Format("{0}<br/>", SteamwareStrings.charLine('-', 80));
foreach (DS_Applicazione.TimbratureExplRow riga in tabTimbExpl)
{
corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}<br/>", riga.dataLav, riga.CognomeNome);
}
corpoEmail += SteamwareStrings.charLine('-', 80);
gestEmail.geAuth.mandaEmail(fromEmail, rigaDip.email, oggettoEmail, corpoEmail);
}
}
}
}
}
// (C) recupero errori mancata copertura orario, mando ad admin
if (memLayer.ML.confReadBool("checkAnomOreLav"))
{
tabDipAndAnom = DataProxy.DP.taDipAnom.GetData(adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, false, true);
tabTimbExpl = DataProxy.DP.taTimbExpl.getByDipAnomalia(0, adesso.AddDays(-gg2Chk), adesso.AddHours(1), false, false, true);
// se ho trovato record...
if (tabTimbExpl.Rows.Count > 0)
{
logger.lg.scriviLog("Trovate anomalie copertura orario, invio email!", tipoLog.INFO);
// mando email ad admin!
oggettoEmail = "Anomalie GPW: Ore timbrate";
if (memLayer.ML.confReadBool("includeDirectUrl"))
{
corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:<br/><a href=\"{0}A1/reviewTimbrature.aspx\">Orario timbrato non suff a copertura standard</a><br/><br/>", memLayer.ML.confReadString("baseUrl"));
}
else
{
corpoEmail = "Risultano a sistema le seguenti anomalie: Orario timbrato non suff a copertura standard<br/>";
}
corpoEmail += string.Format("{0}<br/>", SteamwareStrings.charLine('-', 80));
corpoEmail += "| -- DATA --\t| -- Dipendente --<br/>";
corpoEmail += string.Format("{0}<br/>", SteamwareStrings.charLine('-', 80));
foreach (DS_Applicazione.TimbratureExplRow riga in tabTimbExpl)
{
corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}<br/>", riga.dataLav, riga.CognomeNome);
}
corpoEmail += SteamwareStrings.charLine('-', 80);
gestEmail.geAuth.mandaEmail(fromEmail, adminEmail, oggettoEmail, corpoEmail);
}
}
// (D) recupero errori copertura ore lavorate / ore caricate a commessa...
if (memLayer.ML.confReadBool("checkAnomOreLavComm"))
{
tabTimbRegAtt = DataProxy.DP.taTimbRegAtt.GetData(0, adesso.AddDays(-gg2ChkOreCaricate), adesso.AddHours(1), true, memLayer.ML.confReadInt("maxErrMin"), memLayer.ML.confReadInt("maxErrPlus"));
// sulla tabella seleziono SE NON E' OK colonna okLavCom
if (((DS_Applicazione.TE_RA_ExplRow[])tabTimbRegAtt.Select(" okLavCom = 0 ")).Length > 0)
{
logger.lg.scriviLog("Trovate anomalie ore lavorate / commesse caricate, invio email!", tipoLog.INFO);
// mando email ad admin!
oggettoEmail = "Anomalie GPW: Ore Caricate a commessa";
if (memLayer.ML.confReadBool("includeDirectUrl"))
{
corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:<br/><a href=\"{0}A1/reviewTimbrature.aspx\">ore caricate a commessa non corrispondenti ad ore lavorate secondo range {1} min / {2} min</a><br/><br/>", memLayer.ML.confReadString("baseUrl"), memLayer.ML.confReadInt("maxErrMin"), memLayer.ML.confReadInt("maxErrPlus"));
}
else
{
corpoEmail = "Risultano a sistema le seguenti anomalie: ore caricate a commessa non corrispondenti ad ore lavorate<br/>";
}
corpoEmail += string.Format("{0}<br/>", SteamwareStrings.charLine('-', 80));
corpoEmail += "| -- DATA --\t| -- Dipendente --\t\t| Progetti<br/>";
corpoEmail += string.Format("{0}<br/>", SteamwareStrings.charLine('-', 80));
foreach (DS_Applicazione.TE_RA_ExplRow riga in (DS_Applicazione.TE_RA_ExplRow[])tabTimbRegAtt.Select(" okLavCom = 0 "))
{
corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}\t| {2}<br/>", riga.dataLav, riga.CognomeNome, riga.progetti);
}
corpoEmail += SteamwareStrings.charLine('-', 80);
gestEmail.geAuth.mandaEmail(fromEmail, adminOreLavEmail, oggettoEmail, corpoEmail);
}
}
// (E) cerco anomalie x orario continuato (no Pausa Pranzo, solo 1 IN, 1 OUT)
if (memLayer.ML.confReadBool("checkAnomContinuato"))
{
tabTimbExpl = DataProxy.DP.taTimbExpl.getContinuato(0, adesso.AddDays(-gg2ChkCont), adesso.AddHours(1));
// se ho trovato record...
if (tabTimbExpl.Rows.Count > 0)
{
logger.lg.scriviLog("Trovate anomalie orario continuato, invio email ad admin", tipoLog.INFO);
oggettoEmail = "Anomalie GPW: Orario Continuato";
if (memLayer.ML.confReadBool("includeDirectUrl"))
{
corpoEmail = string.Format("Risultano a sistema le seguenti anomalie:<br/><a href=\"{0}A1/approvTimbrature.aspx\">orari continuati da approvare</a><br/><br/>", memLayer.ML.confReadString("baseUrl"));
}
else
{
corpoEmail = "Risultano a sistema le seguenti anomalie: orari continuati da approvare<br/>";
}
corpoEmail += string.Format("{0}<br/>", SteamwareStrings.charLine('-', 80));
corpoEmail += "| -- DATA --\t| Dipendente<br/>";
corpoEmail += string.Format("{0}<br/>", SteamwareStrings.charLine('-', 80));
foreach (DS_Applicazione.TimbratureExplRow riga in tabTimbExpl)
{
corpoEmail += string.Format("| {0:yyyy.MM.dd ddd}\t| {1}<br/>", riga.dataLav, riga.CognomeNome);
}
corpoEmail += SteamwareStrings.charLine('-', 80);
gestEmail.geAuth.mandaEmail(fromEmail, adminContinuatoEmail, oggettoEmail, corpoEmail);
}
}
answ = true;
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore in procedura check & invio email{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
answ = false;
}
//registro evento
DataProxy.DP.taRE.Insert(DateTime.Now, "checkAnomalie", "-");
return answ;
}
/// <summary>
/// verifica ed eventualmente esegue gli script quotidiani tra cui il check anomalie
/// </summary>
/// <returns></returns>
public bool dailyDuties()
{
bool answ = false;
if (memLayer.ML.confReadInt("_logLevel") > 5) logger.lg.scriviLog("Richiesto Check Daily Duties", tipoLog.INFO);
if (memLayer.ML.confReadBool("enableDailyCheck"))
{
int firstHour2Check = memLayer.ML.confReadInt("firstHour2Check");
// controllo sfasato di x ore come da we.config se ci sia già stato il check quotidiano anomalie (con relative email)
if (DataProxy.DP.taRE.getByDataEv("checkAnomalie", DateTime.Now.AddHours(-firstHour2Check).Date).Rows.Count == 0)
{
// chiamo check anomalie
checkAnomalie();
//registro evento
DataProxy.DP.taRE.Insert(DateTime.Now.AddHours(-firstHour2Check), "dailyDuties", "-");
}
}
return answ;
}
/// <summary>
/// formatta le ore in ore:minuti
/// </summary>
/// <param name="oreCent">ore centesimali (0,00)</param>
/// <returns></returns>
public static string formOreMin(decimal oreCent)
{
return string.Format("{0}:{1:00}", Math.Floor(oreCent), Math.Round((oreCent - Math.Floor(oreCent)) * 60));
}
}
/// <summary>
/// elenco stato controllo
/// </summary>
public enum statoControllo
{
edit,
insert,
item
}
/// <summary>
/// definisce i tipi di codice che il barcode può leggere
/// </summary>
public enum tipoCodiceBarcode
{
/// <summary>
/// Tipo non riconosciuto
/// </summary>
ND,
/// <summary>
/// [idx] - il barcode rappresenta un codice dipendente tipo "idx" + numero
/// </summary>
idxDipendente,
/// <summary>
/// [matr] - il barcode rappresenta un codice dipendente tipo "matr" + matricola
/// </summary>
matrDipendente,
/// <summary>
/// [CF] - il barcode rappresenta un codice dipendente tipo "cf" + cod fiscale dipendente
/// </summary>
cfDipendente,
/// <summary>
/// codice che indica un comando (prefisso da web.config)
/// </summary>
Comando
}
}
+11
View File
@@ -0,0 +1,11 @@
//
// This code was generated by a tool. Any changes made manually will be lost
// the next time this code is regenerated.
//
using System.Reflection;
[assembly: AssemblyVersion("2.0.382.0")]
[assembly: AssemblyFileVersion("2.0.382.0")]
[assembly: AssemblyCopyright("Steamware © 2007-2016")]
[assembly: AssemblyCompany("Steamware")]
+19
View File
@@ -0,0 +1,19 @@
<#@ template language="C#" #>
//
// This code was generated by a tool. Any changes made manually will be lost
// the next time this code is regenerated.
//
using System.Reflection;
[assembly: AssemblyVersion("2.0.382.<#= this.RevisionNumber #>")]
[assembly: AssemblyFileVersion("2.0.382.<#= this.RevisionNumber #>")]
[assembly: AssemblyCopyright("Steamware © 2007-<#= DateTime.Now.Year #>")]
[assembly: AssemblyCompany("Steamware")]
<#+
// int Major = 2;
// int Minor = 4;
// int Build = 602;
// int RevisionNumber = (int)(DateTime.Now - DateTime.Today).TotalSeconds;
int RevisionNumber = 0; //(int)(DateTime.UtcNow - new DateTime(2006,1,1)).TotalDays;
#>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>