123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- <?xml version="1.0" encoding="utf-8"?>
- <Forms>
- <Form Name="FrmIndentNoSale">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @Title="订货未销";
- GetSchema();
- @CurrentRowIndex=0;
- if(Search("SearchIndentNoSaleBill",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
- {
- Search("SearchIndentNoSaleBillProduct",#IndentBill.No_IndentBill);
- }
- ]]>
- </Load>
- <Mode>
- <Search>
- <Lable name="Search" />
- </Search>
- </Mode>
- </Events>
- <Controls>
- <IKExtendGrid name="dgBill" DataSource="IndentBill" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="IndentBill.No_IndentBill" />
- <DataColumn Index="1" DataSource="IndentBill.Date_IndentBill"/>
- <DataColumn Index="2" DataSource="IndentBill.No_Customer" />
- <DataColumn Index="3" DataSource="IndentBill.ShortName_Customer" />
- <Events>
- <ClickPaste>
- ;
- </ClickPaste>
- <ClickExcel>
- ;
- </ClickExcel>
- <ClickPrint>
- ;
- </ClickPrint>
- <ClickPreview>
- Search("SearchTotal",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- PrintReport("FrmIndentNoSale","IndentBillNoSale");
- </ClickPreview>
- <ClickRefresh>
- Empty();
- if(Search("SearchIndentNoSaleBill",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
- {
- Search("SearchIndentNoSaleBillProduct",#IndentBill.No_IndentBill);
- }
- </ClickRefresh>
- <ClickFirstPage>
- ;
- </ClickFirstPage>
- <ClickPrevPage>
- </ClickPrevPage>
- ;
- <ClickNextPage>
- ;
- </ClickNextPage>
- <ClickLastPage>
- ;
- </ClickLastPage>
- <ClickFilter>
- ;
- </ClickFilter>
- <ClickNOFilter>
- ;
- </ClickNOFilter>
- <ClickAdd>
- ;
- </ClickAdd>
- <ClickRemove>
- ;
- </ClickRemove>
- <CurrentCellChanged>
- <![CDATA[
- if(dgBill.dataGrid.CurrentRowIndex!=@CurrentRowIndex)
- {
- @CurrentRowIndex=dgBill.dataGrid.CurrentRowIndex;
- Empty("#IndentBillProduct");
- if(RowCount("#IndentBill","IKExtendGrid") != 0)
- Search("SearchIndentNoSaleBillProduct",dgBill.GetCurrentSpecifyValue("No_IndentBill"));
- }
- ]]>
- </CurrentCellChanged>
- </Events>
- </IKExtendGrid>
- <IKDataGridEx name="dgProduct" DataSource="IndentBillProduct" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="IndentBillProduct.No_Product" />
- <DataColumn Index="1" DataSource="IndentBillProduct.Name_Product" />
- <DataColumn Index="2" DataSource="IndentBillProduct.Quantity_IndentBillProduct" />
- <DataColumn Index="3" DataSource="IndentBillProduct.Quantity_Sale"/>
- <DataColumn Index="4" DataSource="IndentBillProduct.AvailableQty_ProductStocks"/>
- <DataColumn Index="5" DataSource="IndentBillProduct.StockQty_ProductStocks"/>
- </IKDataGridEx>
- </Controls>
- </Client>
- <Server>
- <Tables>
- <Table name="IndentBill" Type="Parent">
- <GetSchema CmdType="Text" CmdText="
- Select Top 0 No_IndentBill,Date_IndentBill,No_Customer,ShortName_Customer
- From IndentBill
- Left Join Customer On Customer.ID_Customer = IndentBill.ID_Customer"/>
- </Table>
- <Table name="IndentBillProduct" Type="Child">
- <GetSchema CmdType="Text" CmdText="
- Select Top 0 No_Product,Name_Product,Quantity_IndentBillProduct,Quantity_Sale,CONVERT(DECIMAL,0.00) AS AvailableQty_ProductStocks,CONVERT(DECIMAL,0.00) AS StockQty_ProductStocks
- From IndentBillProduct
- Left Join Product On Product.ID_Product = IndentBillProduct.ID_Product
- "/>
- </Table>
-
- </Tables>
- <Search>
- <SearchIndentNoSaleBill CmdType="Text" CmdText="
- Select IndentBill.No_IndentBill,IndentBill.Date_IndentBill,No_Customer,ShortName_Customer
- From
- (
- Select distinct ID_IndentBill
- From IndentBillProduct
- where (Quantity_IndentBillProduct-Quantity_Sale) > 0
- )A
- Left Join IndentBill On IndentBill.ID_IndentBill=A.ID_IndentBill
- Left Join Customer On Customer.ID_Customer=IndentBill.ID_Customer
- Where IndentBill.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_IndentBill
-
- ">
- <Params>
- <Param name="@Right" type="IndentBill.ID_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="IndentBill"/>
- </Tables>
- </SearchIndentNoSaleBill>
- <SearchIndentNoSaleBillProduct CmdType="Text" CmdText="
- Declare @ID_Location uniqueidentifier
- SELECT @ID_Location=ID_Location From IndentBill Where No_IndentBill= @No_IndentBill
-
- SELECT D.No_Product, D.Name_Product, D.Quantity_IndentBillProduct, D.Quantity_Sale, ISNULL(E.StockQty_ProductStocks, 0) AS StockQty_ProductStocks, ISNULL(E.AvailableQty_ProductStocks, 0) AS AvailableQty_ProductStocks
- FROM
- (
- SELECT B.ID_Product, C.No_Product, C.Name_Product, ISNULL((B.Quantity_IndentBillProduct),0) As Quantity_IndentBillProduct, ISNULL((B.Quantity_Sale), 0) As Quantity_Sale
- FROM IndentBill A LEFT JOIN IndentBillProduct B ON A.ID_IndentBill = B.ID_IndentBill
- LEFT JOIN Product C ON B.ID_Product = C.ID_Product
- WHERE A.No_IndentBill = @No_IndentBill
- --Group By B.ID_Product, C.No_Product, C.Name_Product
- and ((B.Quantity_IndentBillProduct)-(B.Quantity_Sale)) > 0
- ) D LEFT JOIN
- (
- SELECT A.ID_Product, ISNULL(Sum(A.StockQty_ProductStocks), 0) As StockQty_ProductStocks, ISNULL(Sum(A.AvailableQty_ProductStocks), 0) As AvailableQty_ProductStocks
- FROM ProductStocks A
- LEFT JOIN Location B On B.ID_Location = A.ID_Location
- WHERE B.ID_WareHouse = @ID_Location
- GROUP BY A.ID_Product
- ) E ON D.ID_Product = E.ID_Product
- ">
- <Params>
- <Param name="@No_IndentBill" type="IndentBill.No_IndentBill" Index="0" />
- </Params>
- <Tables>
- <Table name="IndentBillProduct"/>
- </Tables>
- </SearchIndentNoSaleBillProduct>
-
- <SearchTotal CmdType="Text" CmdText="
- Select No_IndentBill,Date_IndentBill,No_Customer,ShortName_Customer,No_Product,Name_Product,Quantity_IndentBillProduct,Quantity_Sale
- From
- (
- Select ID_IndentBill,ID_Product,Sum(Quantity_IndentBillProduct) As Quantity_IndentBillProduct,Sum(Quantity_Sale) As Quantity_Sale
- From IndentBillProduct
- where (Quantity_IndentBillProduct-Quantity_Sale) > 0
- Group By ID_IndentBill,ID_Product
-
- )A
- Left Join IndentBill On IndentBill.ID_IndentBill=A.ID_IndentBill
- /*Left Join
- (
- Select ID_Product,ID_WareHouse,Sum(AvailableQty_ProductStocks),Sum(StockQty_ProductStocks)
- From ProductStocks
- left Join Location On Location.ID_Location=ProductStocks.ID_Location
- Group By ID_Product,ID_WareHouse
- )B On A.ID_Product=B.ID_Product And IndentBill.ID_Location=B.ID_WareHouse*/
- Left Join Product On Product.ID_Product=A.ID_Product
- Left Join Customer On Customer.ID_Customer=IndentBill.ID_Customer
- Where IndentBill.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_IndentBill
- ">
- <Params>
- <Param name="@Right" type="IndentBill.ID_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="IndentBillNoSale"/>
- </Tables>
- </SearchTotal>
- </Search>
- </Server>
- <Lables>
- <Search>
-
- </Search>
- </Lables>
- </Form>
- </Forms>
|