123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- <?xml version="1.0" encoding="utf-8"?>
- <Forms>
- <Form Name="FrmSaleNoOutDepot">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @Title="销货未出库";
- GetSchema();
- @CurrentRowIndex=0;
- if(Search("SearchSaleNoOutBill",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
- {
- Search("SearchSaleNoOutBillProduct",#SaleNoOutBill.No_SaleBill,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- }
- txtSalSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_Sale");
- txtOutdepotSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_OutDepot");
- ]]>
- </Load>
- <Mode>
- <Search>
- <Lable name="Search" />
- </Search>
- </Mode>
- </Events>
- <Controls>
- <!--<IKExtendGrid name="dgProduct" DataSource="SaleNoOutDepot" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="SaleNoOutDepot.No_SaleBill" />
- <DataColumn Index="1" DataSource="SaleNoOutDepot.Date_SaleBill"/>
- <DataColumn Index="2" DataSource="SaleNoOutDepot.No_Customer" />
- <DataColumn Index="3" DataSource="SaleNoOutDepot.ShortName_Customer" />
- <DataColumn Index="4" DataSource="SaleNoOutDepot.GetMethod_SaleBill" />
- <DataColumn Index="5" DataSource="SaleNoOutDepot.Respite_SaleBill" />
- <DataColumn Index="6" DataSource="SaleNoOutDepot.No_Product" />
- <DataColumn Index="7" DataSource="SaleNoOutDepot.Name_Product" />
- <DataColumn Index="8" DataSource="SaleNoOutDepot.Quantity_Sale" />
- <DataColumn Index="9" DataSource="SaleNoOutDepot.Quantity_OutDepot"/>
- <DataColumn Index="10" DataSource="SaleNoOutDepot.AvailableQty_ProductStocks"/>
- <DataColumn Index="11" DataSource="SaleNoOutDepot.StockQty_ProductStocks"/>
- <Events>
- <ClickPaste>
- ;
- </ClickPaste>
- <ClickExcel>
- ;
- </ClickExcel>
- <ClickPrint>
- ;
- </ClickPrint>
- <ClickPreview>
- PrintReport(dgProduct.CurrentView);
- </ClickPreview>
- <ClickRefresh>
- Empty();
- Search("SearchSaleNoOutDepot",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- </ClickRefresh>
- <ClickFirstPage>
- ;
- </ClickFirstPage>
- <ClickPrevPage>
- </ClickPrevPage>
- ;
- <ClickNextPage>
- ;
- </ClickNextPage>
- <ClickLastPage>
- ;
- </ClickLastPage>
- <ClickFilter>
- txtSalSum.CValue = SumOfCol("#SaleNoOutDepot.Quantity_Sale",dgProduct.FilterCondition,true);
- txtOutdepotSum.CValue = SumOfCol("#SaleNoOutDepot.Quantity_OutDepot",dgProduct.FilterCondition,true);
- </ClickFilter>
- <ClickNOFilter>
- txtSalSum.CValue = SumOfCol("#SaleNoOutDepot.Quantity_Sale",dgProduct.FilterCondition,true);
- txtOutdepotSum.CValue = SumOfCol("#SaleNoOutDepot.Quantity_OutDepot",dgProduct.FilterCondition,true);
- </ClickNOFilter>
- <ClickAdd>
- ;
- </ClickAdd>
- <ClickRemove>
- ;
- </ClickRemove>
- </Events>
- </IKExtendGrid>-->
- <IKExtendGrid name="dgSaleBill" DataSource="SaleNoOutBill" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="SaleNoOutBill.No_SaleBill" />
- <DataColumn Index="1" DataSource="SaleNoOutBill.Date_SaleBill"/>
- <DataColumn Index="2" DataSource="SaleNoOutBill.No_Customer" />
- <DataColumn Index="3" DataSource="SaleNoOutBill.ShortName_Customer" />
- <DataColumn Index="4" DataSource="SaleNoOutBill.GetMethod_SaleBill" />
- <DataColumn Index="5" DataSource="SaleNoOutBill.Respite_SaleBill" />
- <Events>
- <ClickPaste>
- ;
- </ClickPaste>
- <ClickExcel>
- ;
- </ClickExcel>
- <ClickPrint>
- ;
- </ClickPrint>
- <ClickPreview>
- Search("SearchTotal",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- PrintReport("FrmSaleNoOutDepot","SaleBillDetail");
- </ClickPreview>
- <ClickRefresh>
- if(Search("SearchSaleNoOutBill",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
- {
- Search("SearchSaleNoOutBillProduct",#SaleNoOutBill.No_SaleBill,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- }
- </ClickRefresh>
- <ClickFirstPage>
- ;
- </ClickFirstPage>
- <ClickPrevPage>
- </ClickPrevPage>
- ;
- <ClickNextPage>
- ;
- </ClickNextPage>
- <ClickLastPage>
- ;
- </ClickLastPage>
- <ClickFilter>
- <![CDATA[
- Empty("#SaleNoOutBillProduct");
- if(RowCount("#SaleNoOutBill","IKExtendGrid") != 0)
- Search("SearchSaleNoOutBillProduct",dgSaleBill.GetCurrentSpecifyValue("No_SaleBill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- txtSalSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_Sale");
- txtOutdepotSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_OutDepot");
- ]]>
- </ClickFilter>
- <ClickNOFilter>
- <![CDATA[
- Empty("#SaleNoOutBillProduct");
- if(RowCount("#SaleNoOutBill","IKExtendGrid") != 0)
- Search("SearchSaleNoOutBillProduct",dgSaleBill.GetCurrentSpecifyValue("No_SaleBill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- txtSalSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_Sale");
- txtOutdepotSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_OutDepot");
- ]]>
- </ClickNOFilter>
- <ClickAdd>
- ;
- </ClickAdd>
- <ClickRemove>
- ;
- </ClickRemove>
- <CurrentCellChanged>
- <![CDATA[
- if(dgSaleBill.dataGrid.CurrentRowIndex!=@CurrentRowIndex)
- {
- @CurrentRowIndex=dgSaleBill.dataGrid.CurrentRowIndex;
- Empty("#SaleNoOutBillProduct");
- if(RowCount("#SaleNoOutBill","IKExtendGrid") != 0)
- Search("SearchSaleNoOutBillProduct",dgSaleBill.GetCurrentSpecifyValue("No_SaleBill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- txtSalSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_Sale");
- txtOutdepotSum.CValue = SumOfCol("#SaleNoOutBillProduct.Quantity_OutDepot");
- }
- ]]>
- </CurrentCellChanged>
- </Events>
- </IKExtendGrid>
- <IKDataGridEx name="dgProduct" DataSource="SaleNoOutBillProduct" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="SaleNoOutBillProduct.No_Product" />
- <DataColumn Index="1" DataSource="SaleNoOutBillProduct.Name_Product" />
- <DataColumn Index="2" DataSource="SaleNoOutBillProduct.Quantity_Sale" />
- <DataColumn Index="3" DataSource="SaleNoOutBillProduct.Quantity_OutDepot"/>
- <DataColumn Index="4" DataSource="SaleNoOutBillProduct.AvailableQty_ProductStocks"/>
- <DataColumn Index="5" DataSource="SaleNoOutBillProduct.StockQty_ProductStocks"/>
- </IKDataGridEx>
- </Controls>
- </Client>
- <Server>
- <Tables>
- <Table name="SaleNoOutBill" Type="Parent">
- <GetSchema CmdType="Text" CmdText="Select Top 0 No_SaleBill,Date_SaleBill,No_Customer,ShortName_Customer,GetMethod_SaleBill,Convert(Nvarchar(64),'') as Respite_SaleBill From SaleBill
- Left Join Customer On Customer.ID_Customer = SaleBill.ID_Customer"/>
- </Table>
- <Table name="SaleNoOutBillProduct" Type="Child">
- <GetSchema CmdType="Text" CmdText="Select Top 0 No_Product,Name_Product,SaleSourceBillProduct.Quantity_Sale,SaleSourceBillProduct.Quantity_OutDepot,CONVERT(DECIMAL,0.00) AS AvailableQty_ProductStocks,CONVERT(DECIMAL,0.00) AS StockQty_ProductStocks From SaleBillProduct
- Left Join SaleSourceBillProduct on SaleSourceBillProduct.ID_SaleSourceBillProduct=SaleBillProduct.ID_SaleSourceBillProduct
- Left join Product On Product.ID_Product = SaleBillProduct.ID_Product"/>
- </Table>
-
- </Tables>
- <Search>
- <SearchSaleNoOutBill CmdType="Text" CmdText="
-
- DECLARE @SaleAndOutDepot_SystemSetting bit
- SELECT @SaleAndOutDepot_SystemSetting=SaleAndOutDepot_SystemSetting from SystemSetting
- IF(@SaleAndOutDepot_SystemSetting != 0)
- Begin
- Select No_SaleBill,Date_SaleBill,No_Customer,ShortName_Customer,GetMethod_SaleBill,OutStatus_SaleBill As Respite_SaleBill
- From
- (
- Select ID_SaleBill,Sum(Quantity_Sale) As Quantity_Sale,Sum(Quantity_OutDepot) As Quantity_OutDepot
- From SaleSourceBillProduct
- Left Join SaleBillProduct On SaleBillProduct.ID_SaleBillProduct=SaleSourceBillProduct.ID_SaleSourceBillProduct
- Group By ID_SaleBill
- Having (Sum(Quantity_Sale)-Sum(Quantity_OutDepot)) > 0
- )A
- Left Join SaleBill On SaleBill.ID_SaleBill=A.ID_SaleBill
- Left Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
- Where SaleBill.ID_Assessor Is Not Null
- And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End
- Order By No_SaleBill
- End
-
- Else
- Begin
- Select No_SaleBill,Date_SaleBill,No_Customer,ShortName_Customer,GetMethod_SaleBill,OutStatus_SaleBill As Respite_SaleBill
- From
- (
- Select ID_SaleBill,Sum(Quantity_SaleBillProduct) As Quantity_Sale
- From SaleBillProduct
- Group By ID_SaleBill
- )a
- Left Join
- (
- Select SaleBill.ID_SaleBill,Sum(SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct) As Quantity_OutDepot
- From SaleOutDepotBillProduct
- Join SaleOutDepotBill On SaleOutDepotBill.ID_SaleOutDepotBill=SaleOutDepotBillProduct.ID_SaleOutDepotBill
- Join SaleBill On SaleBill.No_SaleBill=SaleOutDepotBillProduct.No_FromBill
- Where SaleOutDepotBill.ID_Assessor Is Not Null
- Group By SaleBill.ID_SaleBill
- )b On b.ID_SaleBill=a.ID_SaleBill
- Left Join SaleBill On SaleBill.ID_SaleBill=a.ID_SaleBill
- Left Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
- Where SaleBill.ID_Assessor Is Not Null And (a.Quantity_Sale-b.Quantity_OutDepot) > 0
- And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End
- Order By No_SaleBill
- End
-
- ">
- <Params>
- <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleNoOutBill"/>
- </Tables>
- </SearchSaleNoOutBill>
- <SearchSaleNoOutBillProduct CmdType="Text" CmdText="
- DECLARE @SaleAndOutDepot_SystemSetting bit
-
- Declare @ID_Location uniqueidentifier
- Select @ID_Location=ID_Location From SaleBill
- Where No_SaleBill=@No_SaleBill
-
- SELECT @SaleAndOutDepot_SystemSetting=SaleAndOutDepot_SystemSetting from SystemSetting
- IF(@SaleAndOutDepot_SystemSetting != 0)
- Begin
- Select Product.No_Product,Product.Name_Product,A.Quantity_Sale,A.Quantity_OutDepot,C.AvailableQty_ProductStocks,C.StockQty_ProductStocks
- From Product
- Join
- (
- Select ID_Product,Sum(Quantity_Sale) As Quantity_Sale,Sum(Quantity_OutDepot) As Quantity_OutDepot
- From SaleBillProduct
- Left Join SaleBill On SaleBillProduct.ID_SaleBill=SaleBill.ID_SaleBill
- Left Join SaleSourceBillProduct On SaleSourceBillProduct.ID_SaleSourceBillProduct=SaleBillProduct.ID_SaleBillProduct
- Where No_SaleBill=@No_SaleBill
- Group By ID_Product
- Having (Sum(Quantity_Sale)-Sum(Quantity_OutDepot)) > 0
- )A On Product.ID_Product=A.ID_Product
- Join
- (
- Select ID_Product,Sum(StockQty_ProductStocks) As StockQty_ProductStocks ,Sum(AvailableQty_ProductStocks) As AvailableQty_ProductStocks
- From ProductStocks
- Join Location On Location.ID_Location=ProductStocks.ID_Location
- Where Location.ID_WareHouse=@ID_Location
- Group By ID_Product
- )C On Product.ID_Product=C.ID_Product
- Order By No_Product
- End
- Else
- Begin
- Select Product.No_Product,Product.Name_Product,A.Quantity_Sale,B.Quantity_OutDepot,C.AvailableQty_ProductStocks,C.StockQty_ProductStocks
- From Product
- Join
- (
- Select ID_Product,Sum(Quantity_SaleBillProduct) As Quantity_Sale
- From SaleBillProduct
- Left Join SaleBill On SaleBillProduct.ID_SaleBill=SaleBill.ID_SaleBill
- Where No_SaleBill=@No_SaleBill
- Group By ID_Product
- )A On Product.ID_Product=A.ID_Product
- Left Join
- (
- Select ID_Product,Sum(SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct) As Quantity_OutDepot
- From SaleOutDepotBillProduct
- Join SaleOutDepotBill On SaleOutDepotBill.ID_SaleOutDepotBill=SaleOutDepotBillProduct.ID_SaleOutDepotBill
- Where No_FromBill=@No_SaleBill
- And SaleOutDepotBill.ID_Assessor Is Not Null
- Group By ID_Product
- )B On Product.ID_Product=B.ID_Product
- Join
- (
- Select ID_Product,Sum(StockQty_ProductStocks) As StockQty_ProductStocks ,Sum(AvailableQty_ProductStocks) As AvailableQty_ProductStocks
- From ProductStocks
- Join Location On Location.ID_Location=ProductStocks.ID_Location
- Where Location.ID_WareHouse=@ID_Location
- Group By ID_Product
- )C On Product.ID_Product=C.ID_Product
- Where (A.Quantity_Sale-B.Quantity_OutDepot) > 0
- Order By No_Product
- End
-
- ">
- <Params>
- <Param name="@No_SaleBill" type="SaleBill.No_SaleBill" Index="0" />
- <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
- </Params>
- <Tables>
- <Table name="SaleNoOutBillProduct"/>
- </Tables>
- </SearchSaleNoOutBillProduct>
-
- <SearchTotal CmdType="Text" CmdText="
- DECLARE @SaleAndOutDepot_SystemSetting bit
- SELECT @SaleAndOutDepot_SystemSetting=SaleAndOutDepot_SystemSetting from SystemSetting
- IF(@SaleAndOutDepot_SystemSetting != 0)
- Begin
- Select No_SaleBill,Date_SaleBill,No_Customer,ShortName_Customer,GetMethod_SaleBill,OutStatus_SaleBill As Respite_SaleBill,No_Product,Name_Product,Quantity_Sale,Quantity_OutDepot
- From
- (
- Select ID_SaleBill,ID_Product,Sum(Quantity_Sale) As Quantity_Sale,Sum(Quantity_OutDepot) As Quantity_OutDepot
- From SaleSourceBillProduct
- Left Join SaleBillProduct On SaleBillProduct.ID_SaleBillProduct=SaleSourceBillProduct.ID_SaleSourceBillProduct
-
- Group By ID_SaleBill,ID_Product
- Having (Sum(Quantity_Sale)-Sum(Quantity_OutDepot)) > 0
- )A
- Left Join SaleBill On SaleBill.ID_SaleBill=A.ID_SaleBill
- Left Join Product On Product.ID_Product=A.ID_Product
- Left Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
- Where SaleBill.ID_Assessor Is Not Null
- And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End
- Order By No_SaleBill
- End
-
- Else
- Begin
- Select No_SaleBill,Date_SaleBill,No_Customer,ShortName_Customer,GetMethod_SaleBill,OutStatus_SaleBill As Respite_SaleBill,No_Product,Name_Product,Quantity_Sale,IsNull(Quantity_OutDepot,0)
- From
- (
- Select ID_SaleBill,SaleBillProduct.ID_Product,Sum(Quantity_SaleBillProduct) As Quantity_Sale
- From SaleBillProduct
- Group By ID_SaleBill,ID_Product
- )a
- Left Join
- (
- Select SaleBill.ID_SaleBill,SaleOutDepotBillProduct.ID_Product,Sum(SaleOutDepotBillProduct.Quantity_SaleOutDepotBillProduct) As Quantity_OutDepot
- From SaleOutDepotBillProduct
- Join SaleOutDepotBill On SaleOutDepotBill.ID_SaleOutDepotBill=SaleOutDepotBillProduct.ID_SaleOutDepotBill
- Join SaleBill On SaleBill.No_SaleBill=SaleOutDepotBillProduct.No_FromBill
- Where SaleOutDepotBill.ID_Assessor Is Not Null
- Group By SaleBill.ID_SaleBill,SaleOutDepotBillProduct.ID_Product
- )b On b.ID_SaleBill=a.ID_SaleBill And b.ID_Product=a.ID_Product
- Join Product On Product.ID_Product=a.ID_Product
- Join SaleBill On SaleBill.ID_SaleBill=a.ID_SaleBill
- Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
- Where SaleBill.ID_Assessor Is Not Null And (a.Quantity_Sale-IsNull(b.Quantity_OutDepot,0)) > 0
- And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End
- Order By SaleBill.No_SaleBill
- End
- ">
- <Params>
- <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleBillDetail"/>
- </Tables>
- </SearchTotal>
- </Search>
- </Server>
- <Lables>
- <Search>
-
- </Search>
- <New>
- </New>
- <View>
- </View>
- <Modify>
- </Modify>
- </Lables>
- </Form>
- </Forms>
|