123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344 |
- <?xml version="1.0" encoding="utf-8" ?>
- <Forms>
- <Form Name="FrmInventoryChange">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @Title="异动查询";
- GetSchema();
- Empty();
- ]]>
- </Load>
- </Events>
- <Mode>
- <Search>
- <Lable name="Search" />
- </Search>
- </Mode>
- <Controls>
- <IKTextButton name="ikTextButton1" DataSource="UI.StartNo_Product">
- <Events>
- <Click>
- @temp = ShowSearchBox("ProductSearch","INFOMATION",ikTextButton1.CValue);
- if( @temp == "" )
- return;
- ikTextButton1.CValue = @temp;
- </Click>
- <TextBoxButtonTextChanged>
- ikTextButton2.CValue = ikTextButton1.CValue;
- </TextBoxButtonTextChanged>
- </Events>
- </IKTextButton>
- <IKTextButton name="ikTextButton2" DataSource="UI.EndNo_Product">
- <Events>
- <Click>
- @temp = ShowSearchBox("ProductSearch","INFOMATION",ikTextButton2.CValue);
- if( @temp == "" )
- return;
- ikTextButton2.CValue = @temp;
- </Click>
- </Events>
- </IKTextButton>
- <IKComboBoxEx name="ikComboBoxEx1" DisplaySource="UI.StartModName_ModifyTypeSettings" ValueSource="UI.StartModName_ModifyTypeSettings" DataSource="Type" DisplayMember="result" ValueMember="result">
- <Events>
- <Reload>
- NewInstance();
- UpdateForm(false, "ikComboBoxEx1");
- Search("SearchType");
- UpdateForm(true, "ikComboBoxEx1");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="ikComboBoxEx2" DisplaySource="UI.EndModName_ModifyTypeSettings" ValueSource="UI.EndModName_ModifyTypeSettings" DataSource="Type" DisplayMember="result" ValueMember="result">
- <Events>
- <Reload>
- NewInstance();
- UpdateForm(false, "ikComboBoxEx2");
- Search("SearchType");
- UpdateForm(true, "ikComboBoxEx2");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKDateTimePicker name="ikDateTimePicker1" DataSource="UI.StartDate"/>
- <IKDateTimePicker name="ikDateTimePicker2" DataSource="UI.EndDate"/>
- <IKExtendGrid name="dgProduct" DataSource="Total" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="Total.ModName_ModifyTypeSettings"/>
- <DataColumn Index="1" DataSource="Total.Comment_ModifyDepotBill"/>
- <DataColumn Index="2" DataSource="Total.No_Product"/>
- <DataColumn Index="3" DataSource="Total.Name_Product"/>
- <DataColumn Index="4" DataSource="Total.SUM_Quantity_ModifyDepotBillProduct"/>
- <DataColumn Index="5" DataSource="Total.SUM_Quantity"/>
- <DataColumn Index="6" DataSource="Total.SUM_NoQuantity"/>
- <DataColumn Index="7" DataSource="Total.Date_ModifyDepotBill"/>
- <DataColumn Index="8" DataSource="Total.No_ModifyDepotBill"/>
- <DataColumn Index="9" DataSource="Total.Name_Location"/>
- <Events>
- <ClickPreview>
- PrintReport(dgProduct.CurrentView);
- </ClickPreview>
- <ClickRefresh>
- Empty();
- NewInstance();
- @StartProductNo =DBNull();
- @EndProductNo =DBNull();
- @StartModifyTypeSettings =DBNull();
- @EndModifyTypeSettings =DBNull();
- @StartDate =DBNull();
- @EndDate =DBNull();
- if(!Equals(ikTextButton1.CValue,""))
- @StartProductNo= ikTextButton1.CValue;
- if(!Equals(ikTextButton2.CValue,""))
- @EndProductNo= ikTextButton2.CValue;
- if(!Equals(ikComboBoxEx1.Text,""))
- @StartModifyTypeSettings= ikComboBoxEx1.Text;
- if(!Equals(ikComboBoxEx2.Text,""))
- @EndModifyTypeSettings= ikComboBoxEx2.Text;
- if(ikDateTimePicker1.Checked)
- @StartDate= ikDateTimePicker1.Value;
- if(ikDateTimePicker2.Checked)
- @EndDate= ikDateTimePicker2.Value;
- Search("SearchReceivales",@StartProductNo,@EndProductNo,@StartModifyTypeSettings,@EndModifyTypeSettings,
- @StartDate,@EndDate);
-
- if(Equals(@StartProductNo,DBNull()))
- @StartProductNo = "";
- if(Equals(@EndProductNo,DBNull()))
- @EndProductNo = "";
- if(Equals(@EndModifyTypeSettings,DBNull()))
- @EndModifyTypeSettings = "";
- if(Equals(@StartModifyTypeSettings,DBNull()))
- @StartModifyTypeSettings = "";
-
- #UI.StartNo_Product = @StartProductNo;
- #UI.EndNo_Product = @EndProductNo;
- #UI.StartModName_ModifyTypeSettings = @StartModifyTypeSettings;
- #UI.EndModName_ModifyTypeSettings = @EndModifyTypeSettings;
- #UI.StartDate = @StartDate;
- #UI.EndDate =@EndDate;
- </ClickRefresh>
- <ClickFilter>
- ;
- </ClickFilter>
- <ClickNOFilter>
- ;
- </ClickNOFilter>
- </Events>
- </IKExtendGrid>
- <IKButton name="ikButton1">
- <Events>
- <Click>
- Empty();
- NewInstance();
- @StartProductNo = DBNull();
- @EndProductNo = DBNull();
- @StartModifyTypeSettings = DBNull();
- @EndModifyTypeSettings = DBNull();
- @StartDate =DBNull();
- @EndDate =DBNull();
- if(!Equals(ikTextButton1.CValue,""))
- @StartProductNo= ikTextButton1.CValue;
- if(!Equals(ikTextButton2.CValue,""))
- @EndProductNo= ikTextButton2.CValue;
- if(!Equals(ikComboBoxEx1.Text,""))
- @StartModifyTypeSettings= ikComboBoxEx1.Text;
- if(!Equals(ikComboBoxEx2.Text,""))
- @EndModifyTypeSettings= ikComboBoxEx2.Text;
- if(ikDateTimePicker1.Checked)
- @StartDate= ikDateTimePicker1.Value;
- if(ikDateTimePicker2.Checked)
- @EndDate= ikDateTimePicker2.Value;
- Search("SearchReceivales",@StartProductNo,@EndProductNo,@StartModifyTypeSettings,@EndModifyTypeSettings,
- @StartDate,@EndDate);
-
-
- if(Equals(@StartProductNo,DBNull()))
- @StartProductNo = "";
- if(Equals(@EndProductNo,DBNull()))
- @EndProductNo = "";
- if(Equals(@EndModifyTypeSettings,DBNull()))
- @EndModifyTypeSettings = "";
- if(Equals(@StartModifyTypeSettings,DBNull()))
- @StartModifyTypeSettings = "";
-
- #UI.StartNo_Product = @StartProductNo;
- #UI.EndNo_Product = @EndProductNo;
- #UI.StartModName_ModifyTypeSettings = @StartModifyTypeSettings;
- #UI.EndModName_ModifyTypeSettings = @EndModifyTypeSettings;
- #UI.StartDate = @StartDate;
- #UI.EndDate =@EndDate;
-
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnEmpty">
- <Events>
- <Click>
- Empty();
- ikTextButton1.CValue="";
- ikTextButton2.CValue="";
- ikComboBoxEx1.SelectedName="";
- ikComboBoxEx2.SelectedName="";
- ikDateTimePicker1.Checked=False;
- ikDateTimePicker2.Checked=False;
- </Click>
- </Events>
- </IKButton>
- </Controls>
- <ChildForms>
- <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
- <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn" />
- </ChildForm>
- </ChildForms>
- </Client>
- <Server>
- <Tables>
- <Table name="Total" Type="Child">
- <GetSchema CmdType="Text" CmdText="SELECT TOP 0 ModName_ModifyTypeSettings,Comment_ModifyDepotBill,No_Product,Name_Product,CONVERT(DECIMAL(14,2),0) AS SUM_Quantity_ModifyDepotBillProduct,CONVERT(DECIMAL(14,2),0) AS SUM_Quantity,CONVERT(DECIMAL(14,2),0) AS SUM_NoQuantity,Date_ModifyDepotBill,No_ModifyDepotBill,Name_Location FROM ModifyDepotBill
- LEFT JOIN ModifyDepotBillProduct ON ModifyDepotBillProduct.ID_ModifyDepotBill = ModifyDepotBill.ID_ModifyDepotBill
- LEFT JOIN Product ON Product.ID_Product = ModifyDepotBillProduct.ID_Product
- LEFT JOIN Location ON Location.ID_Location = ModifyDepotBillProduct.ID_Location
- LEFT JOIN ModifyTypeSettings ON ModifyTypeSettings.ID_ModifyTypeSettings = ModifyDepotBill.Style_ModifyDepotBill"/>
- </Table>
- <Table name="UI" Type="Parent">
- <GetSchema CmdType="Text" CmdText="SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS StartNo_Product,CONVERT(NVARCHAR(64),'') AS EndNo_Product,CONVERT(NVARCHAR(64),'') AS StartModName_ModifyTypeSettings,CONVERT(NVARCHAR(64),'') AS EndModName_ModifyTypeSettings,
- CONVERT(DATETIME,0) AS StartDate,CONVERT(DATETIME,0) AS EndDate "/>
- </Table>
- </Tables>
- <Search>
- <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product FROM Product ">
- <Tables>
- <Table name="AllProduct" />
- </Tables>
- </SearchAllProduct>
- <SearchType CmdType="Text" CmdText="select ModName_ModifyTypeSettings as result from ModifyTypeSettings
- UNION SELECT ''">
- <Tables>
- <Table name="Type" />
- </Tables>
- </SearchType>
- <SearchReceivales CmdType="Text" CmdText="
- DECLARE @No_ProductEND nvarchar(64)
- declare @ModName_ModifyTypeSettingsEND nvarchar(64)
- set @No_ProductEND =(SELECT top 1 No_Product FROM Product order by No_Product desc)
- set @ModName_ModifyTypeSettingsEND = (select top 1 ModName_ModifyTypeSettings from ModifyTypeSettings order by ModName_ModifyTypeSettings desc)
- IF Object_ID(N' tempdb..#TEMP') IS Not NULL
- DROP TABLE #TEMP
- CREATE TABLE #TEMP
- (
- ID_ModifyDepotBilltemp UNIQUEIDENTIFIER,
- ID_Producttemp UNIQUEIDENTIFIER,
- ID_Locationtemp UNIQUEIDENTIFIER,
- Quantity_ModifyDepotBilltemp DECIMAL(14,2),
- Quantity_temp DECIMAL(14,2),
- NoQuantity_temp DECIMAL(14,2),
- )
- DECLARE @ID_Product UNIQUEIDENTIFIER
- DECLARE @ID_Location UNIQUEIDENTIFIER
- DECLARE @ID_ModifyDepotBill UNIQUEIDENTIFIER
- DECLARE @Quantity_ModifyDepotBill DECIMAL(14,2)
- set @Quantity_ModifyDepotBill = 0
- DECLARE @Quantity DECIMAL(14,2)
- DECLARE @NoQuantity DECIMAL(14,2)
- set @NoQuantity = 0
- DECLARE @ModName_ModifyTypeSettings NVARCHAR(64)
- DECLARE @STR NVARCHAR(400)
- DECLARE CUR CURSOR FOR SELECT ModName_ModifyTypeSettings,Product.ID_Product,Location.ID_Location,ModifyDepotBill.ID_ModifyDepotBill,SUM_Quantity_ModifyDepotBillProduct,0,0 FROM (SELECT ID_Product,ID_Location,ID_ModifyDepotBill,SUM(Quantity_ModifyDepotBillProduct) AS SUM_Quantity_ModifyDepotBillProduct FROM ModifyDepotBillProduct GROUP BY ID_Product,ID_Location,ID_ModifyDepotBill) L
- LEFT JOIN ModifyDepotBill ON ModifyDepotBill.ID_ModifyDepotBill = L.ID_ModifyDepotBill
- LEFT JOIN ModifyTypeSettings ON ModifyTypeSettings.ID_ModifyTypeSettings = ModifyDepotBill.Style_ModifyDepotBill
- LEFT JOIN Product ON Product.ID_Product= L.ID_Product
- LEFT JOIN Location ON Location.ID_Location = L.ID_Location
- WHERE ModifyDepotBill.ID_Assessor IS NOT NULL AND No_Product >= isnull(@StartProductNo,'') AND No_Product <= isnull(@EndProductNo,@No_ProductEND) and ModName_ModifyTypeSettings >= isnull(@StartModifyTypeSettings,'') and ModName_ModifyTypeSettings <= isnull(@EndModifyTypeSettings,@ModName_ModifyTypeSettingsEND)
- and ModifyDepotBill.Date_ModifyDepotBill >= DateAdd(day,DateDiff(day,0,convert(nvarchar(64),isnull(@StartDate,''))),0) and ModifyDepotBill.Date_ModifyDepotBill <= DateAdd(day,DateDiff(day,0,isnull(@EndDate,getdate())+1),0)
- OPEN CUR
- FETCH NEXT FROM CUR INTO @ModName_ModifyTypeSettings,@ID_Product,@ID_Location,@ID_ModifyDepotBill,@Quantity_ModifyDepotBill,@Quantity,@NoQuantity
- WHILE @@FETCH_STATUS = 0
- BEGIN
- IF(@ModName_ModifyTypeSettings = '借入' OR @ModName_ModifyTypeSettings = '借出')
- BEGIN
- IF(@ModName_ModifyTypeSettings = '借入')
- BEGIN
- IF EXISTS (SELECT * FROM ModifyDepotBill X
- LEFT JOIN ModifyDepotBill Y ON X.No_ModifyDepotBill = Y.Source_ModifyDepotBill
- LEFT JOIN ModifyDepotBillProduct B ON B.ID_ModifyDepotBill = Y.ID_ModifyDepotBill
- LEFT JOIN Product ON Product.ID_Product = B.ID_Product
- LEFT JOIN ModifyTypeSettings D ON D.ID_ModifyTypeSettings = Y.Style_ModifyDepotBill
- WHERE X.ID_Assessor IS NOT NULL AND Y.ID_Assessor IS NOT NULL AND D.ModName_ModifyTypeSettings = '借入归还' AND B.ID_Product = @ID_Product AND X.ID_ModifyDepotBill = @ID_ModifyDepotBill)
- BEGIN
- SELECT @Quantity=B.SUM_Quantity FROM ModifyDepotBill X
- LEFT JOIN ModifyDepotBill Y ON X.No_ModifyDepotBill = Y.Source_ModifyDepotBill
- LEFT JOIN ModifyDepotBillProduct ON ModifyDepotBillProduct.ID_ModifyDepotBill = Y.ID_ModifyDepotBill
- LEFT JOIN (SELECT ID_Product,SUM(Quantity_ModifyDepotBillProduct) AS SUM_Quantity FROM ModifyDepotBillProduct
- LEFT JOIN ModifyDepotBill YY ON YY.ID_ModifyDepotBill = ModifyDepotBillProduct.ID_ModifyDepotBill
- LEFT JOIN ModifyDepotBill XX ON XX.No_ModifyDepotBill = YY.Source_ModifyDepotBill
- LEFT JOIN ModifyTypeSettings ON ModifyTypeSettings.ID_ModifyTypeSettings = YY.Style_ModifyDepotBill
- WHERE YY.ID_Assessor IS NOT NULL AND ModName_ModifyTypeSettings = '借入归还' AND XX.ID_ModifyDepotBill = @ID_ModifyDepotBill
- GROUP BY ID_Product) B ON B.ID_Product = ModifyDepotBillProduct.ID_Product
- WHERE X.ID_Assessor IS NOT NULL AND Y.ID_Assessor IS NOT NULL AND B.ID_Product = @ID_Product AND X.ID_ModifyDepotBill = @ID_ModifyDepotBill
-
- END
- END
- IF(@ModName_ModifyTypeSettings = '借出')
- BEGIN
- IF EXISTS (SELECT * FROM ModifyDepotBill X
- LEFT JOIN ModifyDepotBill Y ON X.No_ModifyDepotBill = Y.Source_ModifyDepotBill
- LEFT JOIN ModifyDepotBillProduct B ON B.ID_ModifyDepotBill = Y.ID_ModifyDepotBill
- LEFT JOIN Product ON Product.ID_Product = B.ID_Product
- LEFT JOIN ModifyTypeSettings D ON D.ID_ModifyTypeSettings = Y.Style_ModifyDepotBill
- WHERE X.ID_Assessor IS NOT NULL AND Y.ID_Assessor IS NOT NULL AND D.ModName_ModifyTypeSettings = '借出归还' AND B.ID_Product = @ID_Product AND X.ID_ModifyDepotBill = @ID_ModifyDepotBill)
- BEGIN
- SELECT @Quantity=B.SUM_Quantity FROM ModifyDepotBill X
- LEFT JOIN ModifyDepotBill Y ON X.No_ModifyDepotBill = Y.Source_ModifyDepotBill
- LEFT JOIN ModifyDepotBillProduct ON ModifyDepotBillProduct.ID_ModifyDepotBill = Y.ID_ModifyDepotBill
- LEFT JOIN (SELECT ID_Product,SUM(Quantity_ModifyDepotBillProduct) AS SUM_Quantity FROM ModifyDepotBillProduct
- LEFT JOIN ModifyDepotBill YY ON YY.ID_ModifyDepotBill = ModifyDepotBillProduct.ID_ModifyDepotBill
- LEFT JOIN ModifyDepotBill XX ON XX.No_ModifyDepotBill = YY.Source_ModifyDepotBill
- LEFT JOIN ModifyTypeSettings ON ModifyTypeSettings.ID_ModifyTypeSettings = YY.Style_ModifyDepotBill
- WHERE YY.ID_Assessor IS NOT NULL AND ModName_ModifyTypeSettings = '借出归还' AND XX.ID_ModifyDepotBill = @ID_ModifyDepotBill
- GROUP BY ID_Product) B ON B.ID_Product = ModifyDepotBillProduct.ID_Product
- WHERE X.ID_Assessor IS NOT NULL AND Y.ID_Assessor IS NOT NULL AND B.ID_Product = @ID_Product AND X.ID_ModifyDepotBill = @ID_ModifyDepotBill
-
- END
- END
- SET @NoQuantity = @Quantity_ModifyDepotBill - @Quantity
- END
-
- SET @STR = N'INSERT INTO #TEMP VALUES(@TID_ModifyDepotBilltemp,@TID_Producttemp,@TID_Locationtemp,@TQuantity_ModifyDepotBilltemp,@TQuantity_temp,@TNoQuantity_temp)'
- EXECUTE sp_executesql @STR,N'@TID_ModifyDepotBilltemp UNIQUEIDENTIFIER,@TID_Producttemp UNIQUEIDENTIFIER,@TID_Locationtemp UNIQUEIDENTIFIER,@TQuantity_ModifyDepotBilltemp DECIMAL(14,2),@TQuantity_temp DECIMAL(14,2),@TNoQuantity_temp DECIMAL(14,2)',@ID_ModifyDepotBill,@ID_Product,@ID_Location,@Quantity_ModifyDepotBill,@Quantity,@NoQuantity
- FETCH NEXT FROM CUR INTO @ModName_ModifyTypeSettings,@ID_Product,@ID_Location,@ID_ModifyDepotBill,@Quantity_ModifyDepotBill,@Quantity,@NoQuantity
- END
- CLOSE CUR
- DEALLOCATE CUR
- SELECT ModName_ModifyTypeSettings,Comment_ModifyDepotBill,No_Product,Name_Product,Quantity_ModifyDepotBilltemp as SUM_Quantity_ModifyDepotBillProduct,Quantity_temp as SUM_Quantity,NoQuantity_temp as SUM_NoQuantity,DATEADD(day, 0, convert(nvarchar(10),Date_ModifyDepotBill,20)) as Date_ModifyDepotBill,No_ModifyDepotBill,Name_Location FROM #TEMP
- LEFT JOIN ModifyDepotBill ON #TEMP.ID_ModifyDepotBilltemp = ModifyDepotBill.ID_ModifyDepotBill
- LEFT JOIN Product ON Product.ID_Product = #TEMP.ID_Producttemp
- LEFT JOIN Location ON Location.ID_Location = #TEMP.ID_Locationtemp
- LEFT JOIN ModifyTypeSettings ON ModifyTypeSettings.ID_ModifyTypeSettings = ModifyDepotBill.Style_ModifyDepotBill
- DROP TABLE #TEMP
- ">
- <Params>
- <Param name="@StartProductNo" type="Product.No_Product" Index="0" />
- <Param name="@EndProductNo" type="Product.No_Product" Index="1" />
- <Param name="@StartModifyTypeSettings" type="ModifyTypeSettings.ModName_ModifyTypeSettings" Index="2" />
- <Param name="@EndModifyTypeSettings" type="ModifyTypeSettings.ModName_ModifyTypeSettings" Index="3" />
- <Param name="@StartDate" type="SaleBill.AssessDate_SaleBill" Index="4" />
- <Param name="@EndDate" type="SaleBill.AssessDate_SaleBill" Index="5" />
- </Params>
- <Tables>
- <Table name="Total"/>
- </Tables>
- </SearchReceivales>
- </Search>
- </Server>
- <Lables>
- <Search>
-
- </Search>
- </Lables>
- </Form>
- </Forms>
|