123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597 |
- <?xml version="1.0" encoding="UTF-8"?>
- <Forms>
- <Form Name="FrmProductInventory">
- <Client>
- <Events>
- <Load><![CDATA[
- @Title="产品库存查询";
- GetSchema();
- ChangeMode("Search");
- RecordHistoryRead("FrmProductInventory");
- Search("SearchCessOut");
- @cessout = #System.CessOut_SystemSetting;
- ]]></Load>
- <Closing>
- RecordHistoryWrite("FrmProductInventory","dtStart","dtEnd","ckNearly","tbNearly"
- ,"ckPriceQuery","ckIndent","ckSaleBill","ckSaleRtn","ckPQuery","ckpurchase","ckInventory","ckSaleOut","ckPurchIn");
- </Closing>
- <Closed>
- ;
- </Closed>
- </Events>
- <Mode>
- <Search>
- <Lable name="Search"/>
- </Search>
- </Mode>
- <Controls>
- <IKTextButton name="tbProduct1">
- <Events>
- <Click>
- @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProduct1.CValue);
- if( @temp == "" )
- return;
- tbProduct1.CValue = @temp;
- </Click>
- <Enter>
- tbProduct2.CValue = tbProduct1.CValue;
- </Enter>
- <TextBoxButtonTextChanged>
- </TextBoxButtonTextChanged>
- </Events>
- </IKTextButton>
- <IKTextButton name="tbProduct2">
- <Events>
- <Click>
- @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProduct2.CValue);
- if( @temp == "" )
- return;
- tbProduct2.CValue = @temp;
- </Click>
- </Events>
- </IKTextButton>
-
- <IKTextButton name="tbPName1">
- <Events>
- <Click>
- @temp = ShowSearchBox("ProductSearch","INFOMATION",tbPName1.CValue);
- if( @temp == "" )
- return;
- tbPName1.CValue = @temp;
- </Click>
- <TextBoxButtonTextChanged>
- </TextBoxButtonTextChanged>
- </Events>
- </IKTextButton>
- <IKTextButton name="tbPName2">
- <Events>
- <Click>
- @temp = ShowSearchBox("ProductSearch","INFOMATION",tbPName2.CValue);
- if( @temp == "" )
- return;
- tbPName2.CValue = @temp;
- </Click>
- </Events>
- </IKTextButton>
-
- <IKComboBoxEx name="cbType1" DataSource="Type" DisplayMember="Type_Product" >
- <Events>
- <Reload>
- UpdateForm(false, "cbType1");
- Search("SearchType");
- UpdateForm(true, "cbType1");
- </Reload>
- <TextChanged>
- cbType2.Text = cbType1.Text;
- </TextChanged>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbType2" DataSource="Type" DisplayMember="Type_Product" >
- <Events>
- <Reload>
- UpdateForm(false, "cbType2");
- Search("SearchType");
- UpdateForm(true, "cbType2");
- </Reload>
- </Events>
- </IKComboBoxEx>
-
- <IKButton name="btnSearch">
- <Events>
- <Click>
- Empty();
- @StartNo_Product=DBNull();
- @EndNo_Product=DBNull();
- @StartType_Product=DBNull();
- @EndType_Product=DBNull();
- if(tbProduct1.CValue!="")
- @StartNo_Product=tbProduct1.CValue;
- if(tbProduct2.CValue!="")
- @EndNo_Product=tbProduct2.CValue;
- if(cbType1.Text!="")
- @StartType_Product=cbType1.Text;
- if(cbType2.Text!="")
- @EndType_Product=cbType2.Text;
- @StartName_Product=tbPName1.CValue==""?DBNull():tbPName1.CValue;
- @EndName_Product=tbPName2.CValue==""?DBNull():tbPName2.CValue;
- Search("SearchProductInventory",@StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@StartName_Product,@EndName_Product);
- if(RowCount("#FrmProductInventory") == 0)
- MessageBox("不存在符合查询条件的记录!");
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnEmpty">
- <Events>
- <Click>
- ChangeMode("Search");
- tbProduct1.CValue="";
- tbProduct2.CValue="";
- cbType1.Text="";
- cbType2.Text="";
- tbPName1.CValue="";
- tbPName2.CValue="";
- </Click>
- </Events>
- </IKButton>
- <IKDataGridEx name="dgHistory" DataSource="ExchangeHistory" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="ExchangeHistory.Date" />
- <DataColumn Index="1" DataSource="ExchangeHistory.Name_Bill" />
- <DataColumn Index="2" DataSource="ExchangeHistory.No_Bill" />
- <DataColumn Index="3" DataSource="ExchangeHistory.No_CustomerOrSupprier" />
- <DataColumn Index="4" DataSource="ExchangeHistory.shortname" />
- <DataColumn Index="5" DataSource="ExchangeHistory.num" />
- <DataColumn Index="6" DataSource="ExchangeHistory.price" />
- <DataColumn Index="7" DataSource="ExchangeHistory.TaxCurrency" />
- <DataColumn Index="8" DataSource="ExchangeHistory.Comment" />
- <Events>
- <RowHeaderDoubleClick>
- DgDoubleClick(#ExchangeHistory.Name_Bill,#ExchangeHistory.No_Bill);
- </RowHeaderDoubleClick>
- </Events>
- </IKDataGridEx>
- <IKButton name="btSearch">
- <Events>
- <Click>
- <![CDATA[
- Empty("#ExchangeHistory");
- @cktn = 0;
-
- if(RowCount("#FrmProductInventory")==0)
- {
- return;
- }
- @CurrentRowNo=dgProduct.GetCurrentSpecifyValue("No_Product");
- ikLabel6.Text = @CurrentRowNo;
- ikLabel10.Text = GetCurrentUser();
- @Right=TypeConvert("String",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- @RightIndentBill=GetFieldRight("订货单","特价单","查看");
- @RightSaleBill=GetFieldRight("销货单","特价单","查看");
-
- @StartTime = DBNull();
- @EndTime = DBNull();
-
- if(dtStart.Checked==true)
- @StartTime = dtStart.CValue;
-
- if(dtEnd.Checked==true)
- @EndTime = dtEnd.CValue;
-
- if(ckNearly.Checked==true)
- {
- @tbNearly=tbNearly.CValue;
- }
- if(ckPriceQuery.Checked == true)
- {
- @cktn = 1;
- if(Search("searchAllBill",ikLabel6.Text,GetCurrentUser(),@cktn,@StartTime,@EndTime))
- {
- MergeTable("#searchAllBill","#ExchangeHistory");
- }
- }
- if(ckIndent.Checked == true)
- {
- @cktn = 2;
- if(Search("searchAllBill",ikLabel6.Text,GetCurrentUser(),@cktn,@StartTime,@EndTime))
- {
- MergeTable("#searchAllBill","#ExchangeHistory");
- }
- }
- if(ckSaleBill.Checked == true)
- {
- @cktn = 3;
- if(Search("searchAllBill",ikLabel6.Text,GetCurrentUser(),@cktn,@StartTime,@EndTime))
- {
- MergeTable("#searchAllBill","#ExchangeHistory");
- }
- }
- if(ckSaleRtn.Checked==true)
- {
- @cktn = 4;
- if(Search("searchAllBill",ikLabel6.Text,GetCurrentUser(),@cktn,@StartTime,@EndTime))
- {
- MergeTable("#searchAllBill","#ExchangeHistory");
- }
- }
- if(ckSaleOut.Checked==true)
- {
- @cktn = 5;
- if(Search("searchAllBill",ikLabel6.Text,GetCurrentUser(),@cktn,@StartTime,@EndTime))
- {
- MergeTable("#searchAllBill","#ExchangeHistory");
- }
- }
- if(ckPQuery.Checked==true)
- {
- @cktn = 6;
- if(Search("searchAllBill",ikLabel6.Text,GetCurrentUser(),@cktn,@StartTime,@EndTime))
- {
- MergeTable("#searchAllBill","#ExchangeHistory");
- }
- }
- if(ckpurchase.Checked==true)
- {
- @cktn = 7;
- if(Search("searchAllBill",ikLabel6.Text,GetCurrentUser(),@cktn,@StartTime,@EndTime))
- {
- MergeTable("#searchAllBill","#ExchangeHistory");
- }
- }
- if(ckInventory.Checked==true)
- {
- @cktn = 8;
- if(Search("searchAllBill",ikLabel6.Text,GetCurrentUser(),@cktn,@StartTime,@EndTime))
- {
- MergeTable("#searchAllBill","#ExchangeHistory");
- }
- }
- if(ckPurchIn.Checked==true)
- {
- @cktn = 9;
- if(Search("searchAllBill",ikLabel6.Text,GetCurrentUser(),@cktn,@StartTime,@EndTime))
- {
- MergeTable("#searchAllBill","#ExchangeHistory");
- }
- }
- if(RowCount("#ExchangeHistory") == 0)
- MessageBox("不存在符合查询条件的记录!");
- ]]></Click>
- </Events>
- </IKButton>
- <IKExtendGrid name="dgProduct" DataSource="FrmProductInventory" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="FrmProductInventory.No_Product"/>
- <DataColumn Index="1" DataSource="FrmProductInventory.Name_Product"/>
- <DataColumn Index="2" DataSource="FrmProductInventory.AvailableQty_ProductStocks"/>
- <DataColumn Index="3" DataSource="FrmProductInventory.StockQty_ProductStocks"/>
- <DataColumn Index="4" DataSource="FrmProductInventory.OnShipQty_Product"/>
- <DataColumn Index="5" DataSource="FrmProductInventory.Quantity_NoSaleOutDepot"/>
- <DataColumn Index="6" DataSource="FrmProductInventory.Quantity_NoSaleRtnInDepot"/>
- <DataColumn Index="7" DataSource="FrmProductInventory.Quantity_NoPurchaseInDepot"/>
- <DataColumn Index="8" DataSource="FrmProductInventory.Price_Product"/>
- <Events>
- <ClickPreview>
- PrintReport(dgProduct.CurrentView, "UIFrmProductInventory","FrmProductInventory");
- </ClickPreview>
- <ClickFilter>
- ;
- </ClickFilter>
- <ClickNOFilter>
- ;
- </ClickNOFilter>
- <ClickRefresh>
- Empty();
- @StartNo_Product=DBNull();
- @EndNo_Product=DBNull();
- @StartType_Product=DBNull();
- @EndType_Product=DBNull();
- if(tbProduct1.CValue!="")
- @StartNo_Product=tbProduct1.CValue;
- if(tbProduct2.CValue!="")
- @EndNo_Product=tbProduct2.CValue;
- if(cbType1.Text!="")
- @StartType_Product=cbType1.Text;
- if(cbType2.Text!="")
- @EndType_Product=cbType2.Text;
- @StartName_Product=tbPName1.CValue==""?DBNull():tbPName1.CValue;
- @EndName_Product=tbPName2.CValue==""?DBNull():tbPName2.CValue;
- Search("SearchProductInventory",@StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@StartName_Product,@EndName_Product);
- </ClickRefresh>
- </Events>
- </IKExtendGrid>
- </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" />
- <DataColumn Index="2" MappingName="#Product.suspension" HeaderText="暂停使用" Width="120" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="3" MappingName="#Product.Price_Product" HeaderText="标准售价" Width="120" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="4" MappingName="#Product.Unit_Product" HeaderText="基本单位" Width="120" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="5" MappingName="#Product.Type_Product" HeaderText="产品大类" Width="120" ColumnType="IKDataGridTextBoxColumn" />
- <DataColumn Index="6" MappingName="#Product.Property_Product" HeaderText="产品性质" Width="120" ColumnType="IKDataGridTextBoxColumn" />
- </ChildForm>
- </ChildForms>
- </Client>
- <Server>
- <Tables>
- <Table name="FrmProductInventory" Type="Child">
- <GetSchema CmdType="Text" CmdText="
- SELECT TOP 0 convert(nvarchar(64),'') As No_Product,convert(nvarchar(64),'') As Name_Product, convert(decimal(14,4),0) As OnShipQty_Product, convert(decimal(14,4),0) As AvailableQty_ProductStocks,convert(decimal(14,4),0) As StockQty_ProductStocks,
- convert(decimal(14,4),0) As Quantity_NoSaleOutDepot,convert(decimal(14,4),0) As Quantity_NoSaleRtnInDepot,convert(decimal(14,4),0) As Quantity_NoPurchaseInDepot,convert(decimal(18,6),0) As Price_Product
-
- "/>
- </Table>
- <Table name="ExchangeHistory" Type="Other">
- <GetSchema CmdType="Text" CmdText=" SELECT Top 0 Date_SaleBill as Date,convert(nvarchar(64),'') as Name_Bill,
- convert(nvarchar(64),'') as No_Bill,convert(nvarchar(64),'') as No_CustomerOrSupprier,convert(nvarchar(64),'')as shortname,
- convert(decimal,0.00) as num,convert(decimal,0.00)as price,convert(nvarchar(64),'') as TaxCurrency,convert(nvarchar(200),'')as Comment
- FROM SaleBill" />
- </Table>
- </Tables>
- <Search>
- <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product,suspension = Case isnull(SuspendDate_Product,0) when 0 then '否' else '是' end,convert(decimal(14,2),Price_Product) as Price_Product,Unit_Product,Type_Product,Product.Property_Product FROM Product">
- <Tables>
- <Table name="AllProduct" />
- </Tables>
- </SearchAllProduct>
- <SearchType CmdType="Text" CmdText=" SELECT Name_TypeDef as Type_Product FROM TypeDef WHERE (Type_TypeDef = 8) ORDER BY Name_TypeDef">
- <Tables>
- <Table name="Type"/>
- </Tables>
- </SearchType>
- <SearchProductInventory CmdType="Text" CmdText="
- SELECT G.*, ISNULL(H.OnShipQty_Product, 0) AS OnShipQty_Product FROM
- (
- Select Product.ID_Product, Product.No_Product,Name_Product,Price_Product,IsNull(A.AvailableQty_ProductStocks,0) As AvailableQty_ProductStocks,IsNull(B.StockQty_ProductStocks,0) As StockQty_ProductStocks,IsNull(C.Quantity_NoSaleOutDepot,0) As Quantity_NoSaleOutDepot,IsNull(D.Quantity_NoSaleRtnInDepot,0) As Quantity_NoSaleRtnInDepot,IsNull(E.Quantity_NoPurchaseInDepot,0) As Quantity_NoPurchaseInDepot
- From Product
- Left Join
- (
- Select ID_Product,Sum(AvailableQty_ProductStocks) As AvailableQty_ProductStocks
- From ProductStocks
- Join Location On Location.ID_Location=ProductStocks.ID_Location
- Where Level_Location=0
- Group BY ID_Product
- )A On A.ID_Product=Product.ID_Product
- Left Join
- (
- Select ID_Product,Sum(StockQty_ProductStocks) As StockQty_ProductStocks
- From ProductStocks
- Join Location On Location.ID_Location=ProductStocks.ID_Location
- Where Level_Location=1
- Group BY ID_Product
- )B On B.ID_Product=Product.ID_Product
- Left Join
- (
- Select SaleBillProduct.ID_Product,Sum(Quantity_Sale-Quantity_OutDepot) As Quantity_NoSaleOutDepot
- From SaleSourceBillProduct
- Join SaleBillProduct On SaleSourceBillProduct.ID_SaleSourceBillProduct=SaleBillProduct.ID_SaleBillProduct
- Where (Quantity_Sale-Quantity_OutDepot)>0
- Group By SaleBillProduct.ID_Product
- )C On C.ID_Product=Product.ID_Product
- Left Join
- (
- Select SaleBillProduct.ID_Product,Sum(Quantity_SaleRtn-Quantity_InDepot) As Quantity_NoSaleRtnInDepot
- From SaleSourceBillProduct
- Join SaleBillProduct On SaleSourceBillProduct.ID_SaleSourceBillProduct=SaleBillProduct.ID_SaleBillProduct
- Where (Quantity_SaleRtn-Quantity_InDepot)>0
- Group By SaleBillProduct.ID_Product
- )D On D.ID_Product=Product.ID_Product
- Left Join
- (
- Select po.ID_Product,Sum(ps.Quantity_Order-ps.Quantity_InDepot-ps.Quantity_EndCase) As Quantity_NoPurchaseInDepot
- From PurchaseSourceBillProduct ps
- Join PurchaseOrderBillProduct po On po.ID_PurchaseOrderBillProduct=ps.ID_PurchaseSourceBillProduct
- Where (ps.Quantity_Order-ps.Quantity_InDepot-ps.Quantity_EndCase)>0
- Group BY po.ID_Product
- )E On E.ID_Product=Product.ID_Product
- Where No_Product between IsNull(@StartNo_Product,No_Product) And IsNull(@EndNo_Product,No_Product)
- And Name_Product between IsNull(@StartName_Product,Name_Product) And IsNull(@EndName_Product,Name_Product)
- And Type_Product between IsNull(@StartType_Product,Type_Product) And IsNull(@EndType_Product,Type_Product)
- And (A.AvailableQty_ProductStocks Is Not Null Or B.StockQty_ProductStocks Is Not Null Or C.Quantity_NoSaleOutDepot Is Not Null Or D.Quantity_NoSaleRtnInDepot Is Not Null Or E.Quantity_NoPurchaseInDepot Is Not Null)
- --Order By Product.Type_Product, Product.Name_Product
- )G
- left join
- (
- select ID_Product, SUM(ISNULL(Quantity_OnShipProduct, 0)) AS OnShipQty_Product from OnShipProduct
- GROUP BY ID_Product
- ) H ON G.ID_Product = H.ID_Product
-
- ">
- <Params>
- <Param name="@StartNo_Product" type="Product.No_Product" Index="0" />
- <Param name="@EndNo_Product" type="Product.No_Product" Index="1" />
- <Param name="@StartType_Product" type="Product.Type_Product" Index="2" />
- <Param name="@EndType_Product" type="Product.Type_Product" Index="3" />
- <Param name="@StartName_Product" type="Product.Name_Product" Index="4" />
- <Param name="@EndName_Product" type="Product.Name_Product" Index="5" />
- </Params>
- <Tables>
- <Table name="FrmProductInventory" />
- </Tables>
- </SearchProductInventory>
- <SearchCessOut CmdType="Text" CmdText=" SELECT SystemSetting.CessOut_SystemSetting FROM SystemSetting">
- <Tables>
- <Table name="System" />
- </Tables>
- </SearchCessOut>
- <searchAllBill CmdType="Text" CmdText=" Declare @ID_Product Uniqueidentifier
- Select @ID_Product = ID_Product From Product Where No_Product =@No_Product
- SELECT * FROM
- (SELECT Top 0 convert(datetime,'') as Date,convert(nvarchar(64),'') as Name_Bill,
- convert(nvarchar(64),'') as No_Bill,convert(nvarchar(64),'') as No_CustomerOrSupprier,convert(nvarchar(64),'')as shortname,
- convert(decimal,0.00) as num,convert(decimal,0.00)as price,convert(nvarchar(200),'')as Comment,SaleBill.ID_Assessor as ID_Assessor,convert(nvarchar(64),'') as No_Product,convert(nvarchar(64),'') as TaxCurrency
- FROM SaleBill
- Union all
- select PriceQueryBill.Date_PriceQueryBill as Date
- ,convert(nvarchar(64),'报价单') as Name_Bill
- ,PriceQueryBill.No_PriceQueryBill as No_Bill
- ,Customer.No_Customer as No_CustomerOrSupprier
- ,Customer.ShortName_Customer as shortname
- ,PriceQueryBillProduct.Quantity_PriceQueryBillProduct as num,
- PriceQueryBillProduct.UnitPrice_PriceQueryBillProduct as price,
- PriceQueryBillProduct.Comment_PriceQueryBillProduct as Comment,
- PriceQueryBill.ID_Assessor as ID_Assessor,Product.No_Product as No_Product
- ,PriceQueryBill.TaxCurrency_PriceQueryBill as TaxCurrency
- From PriceQueryBill
- join PriceQueryBillProduct on PriceQueryBill.ID_PriceQueryBill = PriceQueryBillProduct.ID_PriceQueryBill
- left join Customer on Customer.ID_Customer=PriceQueryBill.ID_Customer
- left join Product on PriceQueryBillProduct.ID_Product = Product.ID_Product
- where Customer.ID_Creator IS NOT NULL
- AND Customer.No_Customer in ( Select No_Customer From Customer Where ID_RegionalLeader in(Select ID_RegionalLeader From Principal Left join Employee on Employee.ID_Employee = Principal.ID_Employee Where Name_Employee = @Name_Employee))
- and PriceQueryBill.ID_Assessor is not null
- And @cktn =1
- union all
- select IndentBill.Date_IndentBill as Date,convert(nvarchar(64),'订货单') as Name_Bill,IndentBill.No_IndentBill as No_Bill,
- Customer.No_Customer as No_CustomerOrSupprier,Customer.ShortName_Customer as shortname,
- IndentBillProduct.Quantity_IndentBillProduct as num,
- IndentBillProduct.UnitPrice_IndentBillProduct as price,
- IndentBillProduct.Comment_IndentBillProduct as Comment,
- IndentBill.ID_Assessor as ID_Assessor,Product.No_Product as No_Product,IndentBill.TaxCurrency_IndentBill as TaxCurrency
- from IndentBill
- join IndentBillProduct on IndentBill.ID_IndentBill=IndentBillProduct.ID_IndentBill
- left join Customer on Customer.ID_Customer=IndentBill.ID_Customer
- left join Product on IndentBillProduct.ID_Product = Product.ID_Product
- where Customer.ID_Creator is not null
- and IndentBill.ID_Assessor is not null
- AND Customer.No_Customer in ( Select No_Customer From Customer Where ID_RegionalLeader in(Select ID_RegionalLeader From Principal Left join Employee on Employee.ID_Employee = Principal.ID_Employee Where Name_Employee = @Name_Employee))
- And @cktn =2
-
- Union all
- select SaleBill.Date_SaleBill as Date,convert(nvarchar(64),'销货单') as Name_Bill,SaleBill.No_SaleBill as No_Bill,
- Customer.No_Customer as No_CustomerOrSupprier,Customer.ShortName_Customer as shortname,
- SaleBillProduct.Quantity_SaleBillProduct as num,
- SaleBillProduct.UnitPrice_SaleBillProduct as price,
- SaleBillProduct.Comment_SaleBillProduct as Comment,
- SaleBill.ID_Assessor as ID_Assessor,Product.No_Product as No_Product,SaleBill.TaxCurrency_SaleBill as TaxCurrency
- from SaleBill
- join SaleBillProduct on SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill
- left join Customer on Customer.ID_Customer=SaleBill.ID_Customer
- left join Product on SaleBillProduct.ID_Product = Product.ID_Product
- where Customer.ID_Creator is not null
- AND Customer.No_Customer in ( Select No_Customer From Customer Where ID_RegionalLeader in(Select ID_RegionalLeader From Principal Left join Employee on Employee.ID_Employee = Principal.ID_Employee Where Name_Employee = @Name_Employee))
- And SaleBill.ID_Assessor is not null
- And @cktn =3
- Union all
- select SaleRtnBill.Date_SaleRtnBill as Date,convert(nvarchar(64),'销售退货单') as Name_Bill,SaleRtnBill.No_SaleRtnBill as No_Bill,
- Customer.No_Customer as No_CustomerOrSupprier,Customer.ShortName_Customer as shortname,
- SaleRtnBillProduct.Quantity_SaleRtnBillProduct as num,
- SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct as price,
- SaleRtnBillProduct.Comment_SaleRtnBillProduct as Comment,
- SaleRtnBill.ID_Assessor as ID_Assessor,Product.No_Product as No_Product,SaleRtnBill.TaxCurrency_SaleRtnBill as TaxCurrency
- from SaleRtnBill
- join SaleRtnBillProduct on SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- left join Customer on Customer.ID_Customer=SaleRtnBill.ID_Customer
- left join Product on SaleRtnBillProduct.ID_Product = Product.ID_Product
- where Customer.ID_Creator is not null
- AND Customer.No_Customer in ( Select No_Customer From Customer Where ID_RegionalLeader in(Select ID_RegionalLeader From Principal Left join Employee on Employee.ID_Employee = Principal.ID_Employee Where Name_Employee = @Name_Employee))
- and SaleRtnBill.ID_Assessor is not null
- And @cktn =4
- Union all
- select SaleOutDepotBill.Date_SaleOutDepotBill as Date,convert(nvarchar(64),'销货出库单') as Name_Bill,SaleOutDepotBill.No_SaleOutDepotBill as No_Bill,
- Customer.No_Customer as No_CustomerOrSupprier,Customer.ShortName_Customer as shortname,
- SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct as num,
- isnull(SaleBillProduct.UnitPrice_SaleBillProduct,0.00) as price,
- SaleOutDepotBillProduct.Comment_SaleOutDepotBillProduct as Comment,
- SaleOutDepotBill.ID_Assessor as ID_Assessor,Product.No_Product as No_Product,'' as TaxCurrency
- from SaleOutDepotBill
- join SaleOutDepotBillProduct on SaleOutDepotBill.ID_SaleOutDepotBill=SaleOutDepotBillProduct.ID_SaleOutDepotBill And SaleOutDepotBillProduct.ID_Product = @ID_Product
- left join Customer on Customer.ID_Customer=SaleOutDepotBill.ID_Customer
- left join Product on SaleOutDepotBillProduct.ID_Product = Product.ID_Product And SaleOutDepotBillProduct.ID_Product = @ID_Product
- left join SaleBillProduct on SaleBillProduct.ID_Product = @ID_Product And SaleOutDepotBillProduct.Type_FromBill=21
- and SaleOutDepotBillProduct.No_FromBill=(select SaleBill.No_SaleBill from SaleBill where SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill)
- and SaleOutDepotBillProduct.No_FromBillProduct=SaleBillProduct.No_SaleBillProduct
- where Customer.No_Customer in ( Select No_Customer From Customer Where ID_RegionalLeader in(Select ID_RegionalLeader From Principal Left join Employee on Employee.ID_Employee = Principal.ID_Employee Where Name_Employee = @Name_Employee))
- and SaleOutDepotBill.ID_Assessor is not null
- And @cktn =5
- Union all
- select PurchaseQueryBill.Date_PurchaseQueryBill as Date,convert(nvarchar(64),'询价单') as Name_Bill,PurchaseQueryBill.No_PurchaseQueryBill as No_Bill,
- Supplier.No_Supplier as No_CustomerOrSupprier,Supplier.ShortName_Supplier as shortname,
- PurchaseQueryBillProduct.Quantity_PurchaseQueryBillProduct as num,
- PurchaseQueryBillProduct.UnitPrice_PurchaseQueryBillProduct as price,
- PurchaseQueryBillProduct.Comment_PurchaseQueryBillProduct as Comment,
- PurchaseQueryBill.ID_Assessor as ID_Assessor,Product.No_Product as No_Product,PurchaseQueryBill.TaxCurrency_PurchaseQueryBill as TaxCurrency
- from PurchaseQueryBill
- join PurchaseQueryBillProduct on PurchaseQueryBill.ID_PurchaseQueryBill=PurchaseQueryBillProduct.ID_PurchaseQueryBill
- left join Supplier on Supplier.ID_Supplier=PurchaseQueryBill.ID_Supplier
- left join Product on PurchaseQueryBillProduct.ID_Product = Product.ID_Product
- Where PurchaseQueryBill.ID_Assessor is not null
- And @cktn =6
-
- Union all
- select PurchaseOrderBill.Date_PurchaseOrderBill as Date,convert(nvarchar(64),'采购订单') as Name_Bill,PurchaseOrderBill.No_PurchaseOrderBill as No_Bill,
- Supplier.No_Supplier as No_CustomerOrSupprier,Supplier.ShortName_Supplier as shortname,
- PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct as num,
- PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct as price,
- PurchaseOrderBillProduct.Comment_PurchaseOrderBillProduct as Comment,
- PurchaseOrderBill.ID_Assessor as ID_Assessor,Product.No_Product as No_Product,PurchaseOrderBill.TaxCurrency_PurchaseOrderBill as TaxCurrency
- from PurchaseOrderBill
- join PurchaseOrderBillProduct on PurchaseOrderBill.ID_PurchaseOrderBill=PurchaseOrderBillProduct.ID_PurchaseOrderBill
- left join Supplier on Supplier.ID_Supplier=PurchaseOrderBill.ID_Supplier
- left join Product on PurchaseOrderBillProduct.ID_Product = Product.ID_Product
- Where PurchaseOrderBill.ID_Assessor is not null
- And @cktn =7
- Union all
- select ModifyDepotBill.Date_ModifyDepotBill as Date,convert(nvarchar(64),('库存异动作业'+'('+ModName_ModifyTypeSettings+')')) as Name_Bill,ModifyDepotBill.No_ModifyDepotBill as No_Bill,'' as No_CustomerOrSupprier,
- shortname= case when ModName_ModifyTypeSettings='销退入库' or ModName_ModifyTypeSettings='借出' or ModName_ModifyTypeSettings='借出归还' or ModName_ModifyTypeSettings='借入' or ModName_ModifyTypeSettings='借入归还' then ModifyDepotBill.Comment_ModifyDepotBill else '' end,
- ModifyDepotBillProduct.Quantity_ModifyDepotBillProduct as num,0 as price,ModifyDepotBillProduct.Comment_ModifyDepotBillProduct as Comment,
- ModifyDepotBill.ID_Assessor as ID_Assessor,Product.No_Product as No_Product,'' as TaxCurrency
- from ModifyDepotBill
- join ModifyDepotBillProduct on ModifyDepotBill.ID_ModifyDepotBill=ModifyDepotBillProduct.ID_ModifyDepotBill
- left join Product on ModifyDepotBillProduct.ID_Product = Product.ID_Product
- LEFT JOIN ModifyTypeSettings ON ModifyTypeSettings.ID_ModifyTypeSettings = ModifyDepotBill.Style_ModifyDepotBill
- Where ModifyDepotBill.ID_Assessor is not null
- And @cktn =8
- Union all
- select PurchaseInDepotBill.Date_PurchaseInDepotBill as Date,convert(nvarchar(64),'采购入库单') as Name_Bill,PurchaseInDepotBill.No_PurchaseInDepotBill as No_Bill,
- Supplier.No_Supplier as No_CustomerOrSupprier,Supplier.ShortName_Supplier as shortname,
- PurchaseInDepotBillProduct.Quantity_PurchaseInDepotBillProduct as num,
- isnull(PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct,0.00) as price,
- PurchaseInDepotBillProduct.Comment_PurchaseInDepotBillProduct as Comment,
- PurchaseInDepotBill.ID_Assessor as ID_Assessor,Product.No_Product as No_Product,'' as TaxCurrency
- from PurchaseInDepotBill
- join PurchaseInDepotBillProduct on PurchaseInDepotBill.ID_PurchaseInDepotBill=PurchaseInDepotBillProduct.ID_PurchaseInDepotBill
- left join Supplier on Supplier.ID_Supplier=PurchaseInDepotBill.ID_Supplier
- left join Product on PurchaseInDepotBillProduct.ID_Product = Product.ID_Product
- left join PurchaseOrderBillProduct on PurchaseInDepotBillProduct.Type_FromBill=41
- and PurchaseInDepotBillProduct.No_FromBill=(select PurchaseOrderBill.No_PurchaseOrderBill from PurchaseOrderBill where PurchaseOrderBill.ID_PurchaseOrderBill=PurchaseOrderBillProduct.ID_PurchaseOrderBill)
- and PurchaseInDepotBillProduct.No_FromBillProduct=PurchaseOrderBillProduct.No_PurchaseOrderBillProduct
- Where PurchaseInDepotBill.ID_Assessor is not null
- And @cktn =9
- )A
- where A.No_Product = @No_Product
- AND A.Date Between isnull(DateAdd(day,DateDiff(day,0,@StartTime),0),A.Date)
- AND Isnull(DateAdd(day,DateDiff(day,0,@EndTime),1),A.Date)
- Order By Date desc
- ">
- <Params>
- <Param name="@No_Product" type="Customer.No_Customer" />
- <Param name="@Name_Employee" type="Employee.Name_Employee" />
- <Param name="@cktn" type="Customer.DunDate_Customer" />
- <Param name="@StartTime" type="PurchaseInDepotBill.Date_PurchaseInDepotBill" />
- <Param name="@EndTime" type="PurchaseInDepotBill.Date_PurchaseInDepotBill" />
- </Params>
- <Tables>
- <Table name="searchAllBill" />
- </Tables>
- </searchAllBill>
- </Search>
- </Server>
- <Lables>
- <Search>
- Empty();
- Empty("#ExchangeHistory");
- NewInstance();
- </Search>
- </Lables>
- </Form>
- </Forms>
-
-
-
|