123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385 |
- <?xml version="1.0" encoding="utf-8"?>
- <Forms>
- <Form Name="FrmSaleNoBilling">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @Title="销货未开票";
- GetSchema();
- @CurrentRowIndex=0;
- if(Search("SearchSaleNoBill",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
- {
- Search("SearchSaleNoBillProduct",#SaleNoBill.No_Bill,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- }
- txtSalSum.CValue = SumOfCol("#SaleNoBillProduct.Quantity_SaleBillProduct");
-
- ]]>
- </Load>
- <Mode>
- <Search>
- <Lable name="Search" />
- </Search>
- </Mode>
- </Events>
- <Controls>
- <IKExtendGrid name="dgSaleBill" DataSource="SaleNoBill" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="SaleNoBill.No_Bill" />
- <DataColumn Index="1" DataSource="SaleNoBill.Date"/>
- <DataColumn Index="2" DataSource="SaleNoBill.No_Customer" />
- <DataColumn Index="3" DataSource="SaleNoBill.ShortName_Customer" />
- <DataColumn Index="4" DataSource="SaleNoBill.GetMethod_Bill" />
- <DataColumn Index="5" DataSource="SaleNoBill.Name_Bill" />
- <Events>
- <ClickPaste>
- ;
- </ClickPaste>
- <ClickExcel>
- ;
- </ClickExcel>
- <!--<ClickExcel>
- Search("SearchTotal",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- ExcelReport("FrmSaleNoBilling","SaleBillDetail");
- </ClickExcel>-->
- <ClickPrint>
- ;
- </ClickPrint>
- <ClickPreview>
- Search("SearchTotal",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID() , dgSaleBill.SqlText);
- PrintReport("FrmSaleNoBilling","SaleBillDetail");
- </ClickPreview>
- <ClickRefresh>
- if(Search("SearchSaleNoBill",GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID()))
- {
- Search("SearchSaleNoBillProduct",#SaleNoBill.No_Bill,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- }
- </ClickRefresh>
- <ClickFirstPage>
- ;
- </ClickFirstPage>
- <ClickPrevPage>
- ;
- </ClickPrevPage>
- <ClickNextPage>
- ;
- </ClickNextPage>
- <ClickLastPage>
- ;
- </ClickLastPage>
-
- <ClickFilter>
- <![CDATA[
- Empty("#SaleNoBillProduct");
- if(RowCount("#SaleNoBill","IKExtendGrid") != 0)
- Search("SearchSaleNoBillProduct",dgSaleBill.GetCurrentSpecifyValue("No_Bill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- txtSalSum.CValue = SumOfCol("#SaleNoBillProduct.Quantity_SaleBillProduct");
- ]]>
- </ClickFilter>
-
- <ClickNOFilter>
- <![CDATA[
- Empty("#SaleNoBillProduct");
- if(RowCount("#SaleNoBill","IKExtendGrid") != 0)
- Search("SearchSaleNoBillProduct",dgSaleBill.GetCurrentSpecifyValue("No_Bill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- txtSalSum.CValue = SumOfCol("#SaleNoBillProduct.Quantity_SaleBillProduct");
- ]]>
- </ClickNOFilter>
- <ClickAdd>
- ;
- </ClickAdd>
- <ClickRemove>
- ;
- </ClickRemove>
- <CurrentCellChanged>
- <![CDATA[
- if(dgSaleBill.dataGrid.CurrentRowIndex!=@CurrentRowIndex)
- {
- @CurrentRowIndex=dgSaleBill.dataGrid.CurrentRowIndex;
- Empty("#SaleNoBillProduct");
- if(RowCount("#SaleNoBill","IKExtendGrid") != 0)
- {
- Search("SearchSaleNoBillProduct",dgSaleBill.GetCurrentSpecifyValue("No_Bill"),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- }
- txtSalSum.CValue = SumOfCol("#SaleNoBillProduct.Quantity_SaleBillProduct");
- }
- ]]>
- </CurrentCellChanged>
- </Events>
- </IKExtendGrid>
- <IKDataGridEx name="dgProduct" DataSource="SaleNoBillProduct" TableStyleIndex="0">
- <DataColumn Index="0" DataSource="SaleNoBillProduct.No_Product" />
- <DataColumn Index="1" DataSource="SaleNoBillProduct.Name_Product" />
- <DataColumn Index="2" DataSource="SaleNoBillProduct.Quantity_SaleBillProduct" />
- <DataColumn Index="3" DataSource="SaleNoBillProduct.UnitPrice_SaleBillProduct" />
- <DataColumn Index="4" DataSource="SaleNoBillProduct.TaxCurrency_SaleBill" />
- <DataColumn Index="5" DataSource="SaleNoBillProduct.MoneyCurrency" />
- <DataColumn Index="6" DataSource="SaleNoBillProduct.TaxCurrency" />
- </IKDataGridEx>
- </Controls>
- </Client>
- <Server>
- <Tables>
- <Table name="SaleNoBill" Type="Parent">
- <GetSchema CmdType="Text" CmdText="Select Top 0 Convert(nvarchar(64),'') As No_Bill
- ,Convert(datetime,0) As Date
- ,Convert(Nvarchar(64),'') as No_Customer
- ,Convert(Nvarchar(64),'') as ShortName_Customer
- ,Convert(Nvarchar(64),'') as GetMethod_Bill
- ,Convert(Nvarchar(64),'') as Name_Bill
- From SaleBill
- "/>
- </Table>
- <Table name="SaleNoBillProduct" Type="Child">
- <GetSchema CmdType="Text" CmdText="Select Top 0 Convert(nvarchar(64),'') As No_Product
- , Convert(nvarchar(64),'') As Name_Product
- , Convert(decimal,0.00) As Quantity_SaleBillProduct
- ,Convert(decimal,0.00) As UnitPrice_SaleBillProduct
- ,Convert(nvarchar(64),'') As TaxCurrency_SaleBill
- ,Convert(decimal,0.00) As MoneyCurrency
- ,Convert(decimal,0.00) As TaxCurrency
- From SaleBillProduct
-
- "/>
- </Table>
- </Tables>
- <Search>
- <SearchSaleNoBill CmdType="Text" CmdText="
-
- Select SaleBill.No_SaleBill as No_Bill
- ,Convert(datetime,SaleBill.Date_SaleBill) as Date
- ,No_Customer,ShortName_Customer
- ,SaleBill.GetMethod_SaleBill as GetMethod_Bill
- ,convert(nvarchar(64),'销货单') as Name_Bill
- From SaleBill
- Left Join Customer On Customer.ID_Customer=SaleBill.ID_Customer
- Where SaleBill.No_SaleBill in (
- select distinct No_SaleBill from (
- Select No_SaleBill From SaleBill
- left join SaleBillProduct ON SaleBillProduct.ID_SaleBill = SaleBill.ID_SaleBill
- left join
- (
- SELECT No_FromBill
- ,No_FromBillProduct
- ,Sum(Quantity_SaleRtnBillProduct) As Quantity_SaleRtnBillProduct
- From
- (
- Select No_FromBill
- ,No_FromBillProduct
- ,Quantity_SaleRtnBillProduct
- From SaleRtnBillProduct
- Join SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- Where SaleRtnBill.ID_Assessor Is Not Null
- And SaleRtnBill.Disable_SaleRtnBill = 0
- )InnerA
- Group By No_FromBill,No_FromBillProduct
- )A On A.No_FromBill=SaleBill.No_SaleBill And A.No_FromBillProduct=SaleBillProduct.No_SaleBillProduct
- WHERE (SaleBillProduct.Quantity_SaleBillProduct-IsNull(A.Quantity_SaleRtnBillProduct,0)) > 0
- And SaleBill.ID_Assessor is not null
- and SaleBill.Assess_SaleBill = 0
- And SaleBill.Disable_SaleBill = 0
- AND SaleBillProduct.ID_SaleBill in (Select ID_SaleBill from SaleBill)
- And SaleBill.Date_SaleBill >='2009-12-21 00:00:01' ) temp
- )
- And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End
- Order by No_Bill
-
-
- ">
- <Params>
- <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="SaleNoBill"/>
- </Tables>
- </SearchSaleNoBill>
- <SearchSaleNoBillProduct CmdType="Text" CmdText="
- declare @CessOut decimal(5,2)
- Select @CessOut = CessOut_SystemSetting/100 from SystemSetting
- Select Product.No_Product
- ,Product.Name_Product
- ,(SaleBillProduct.Quantity_SaleBillProduct-IsNull(A.Quantity_SaleRtnBillProduct,0)) As Quantity_SaleBillProduct
- ,SaleBillProduct.UnitPrice_SaleBillProduct
- ,SaleBill.TaxCurrency_SaleBill
- ,case SaleBill.TaxCurrency_SaleBill
- When '内含'
- Then ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)/(1+@CessOut))---IsNull(A.SaleRtnMoneyCurrency,0))
- else ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))---IsNull(A.SaleRtnMoneyCurrency,0))
- end as MoneyCurrency --未税小计
- -- ,case SaleBill.TaxCurrency_SaleBill
- --when '外加'
- --then (Convert(decimal(18,2),Convert(decimal(18,2),SaleBillProduct.UnitPrice_SaleBillProduct*SaleBillProduct.Quantity_SaleBillProduct)*@CessOut)-IsNull(A.SaleRtnTaxCurrency,0))
- --when '内含' then (Convert(decimal(18,2),(Convert(decimal(18,2),SaleBillProduct.UnitPrice_SaleBillProduct*SaleBillProduct.Quantity_SaleBillProduct)*@CessOut)/(1+@CessOut))-IsNull(A.SaleRtnTaxCurrency,0))
- --else -IsNull(A.SaleRtnTaxCurrency,0)
- --end as TaxCurrency --含税小计
- ,
- case SaleBill.TaxCurrency_SaleBill
- When '外加'
- Then ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(1+@CessOut))---IsNull(A.SaleRtnMoneyCurrency,0))
- else ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))---IsNull(A.SaleRtnMoneyCurrency,0))
- end as TaxCurrency --含税小计
- --Convert(decimal(18,2),Convert(decimal(18,2),SaleBill.GoodsAmount_SaleBill +SaleBill.TaxAmount_SaleBill))-IsNull(A.SaleRtnTaxCurrency,0) as TaxCurrency
- From SaleBillProduct
- LEFT JOIN SaleBill ON SaleBill.ID_SaleBill = SaleBillProduct.ID_SaleBill
- LEFT JOIN Product ON Product.ID_Product = SaleBillProduct.ID_Product
- LEFT JOIN Customer on Customer.ID_Customer = SaleBill.ID_Customer
- Left Join
- (
- SELECT No_FromBill
- ,No_FromBillProduct
- ,Sum(Quantity_SaleRtnBillProduct) As Quantity_SaleRtnBillProduct
- --,Sum(SaleRtnTaxCurrency) As SaleRtnTaxCurrency
- ,Sum(SaleRtnMoneyCurrency) As SaleRtnMoneyCurrency
- From
- (
- Select No_FromBill
- ,No_FromBillProduct
- ,Quantity_SaleRtnBillProduct
- ,case SaleRtnBill.TaxCurrency_SaleRtnBill
- When '内含'
- Then (Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)/(1+@CessOut)
- else (Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)
- end as SaleRtnMoneyCurrency
-
- --,case SaleRtnBill.TaxCurrency_SaleRtnBill
- --when '外加'
- --then Convert(decimal(18,2),Convert(decimal(18,2),SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct*SaleRtnBillProduct.Quantity_SaleRtnBillProduct)*@CessOut)
- --when '内含'
- --then Convert(decimal(18,2),(Convert(decimal(18,2),SaleRtnBillProduct.UnitPrice_SaleRtnBillProduct*SaleRtnBillProduct.Quantity_SaleRtnBillProduct)*@CessOut)/(1+@CessOut)) else 0
- --end as SaleRtnTaxCurrency
- ,Convert(decimal(18,2),Convert(decimal(18,2),SaleRtnBill.GoodsAmount_SaleRtnBill+SaleRtnBill.TaxAmount_SaleRtnBill))
- as SaleRtnTaxCurrency
- From SaleRtnBillProduct
- Join SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- Where SaleRtnBill.ID_Assessor Is Not Null
- And SaleRtnBill.Disable_SaleRtnBill = 0
- )InnerA
- Group By No_FromBill,No_FromBillProduct
- )A On A.No_FromBill=SaleBill.No_SaleBill And A.No_FromBillProduct=SaleBillProduct.No_SaleBillProduct
- WHERE (SaleBillProduct.Quantity_SaleBillProduct-IsNull(A.Quantity_SaleRtnBillProduct,0)) > 0
- And SaleBill.ID_Assessor is not null
- And SaleBill.Disable_SaleBill = 0
- and SaleBill.Assess_SaleBill = 0
- AND SaleBillProduct.ID_SaleBill in (Select ID_SaleBill from SaleBill)
- and No_SaleBill=@No_Bill
- Order by Customer.No_Customer,SaleBill.No_SaleBill,Product.No_Product
-
-
- ">
- <Params>
- <Param name="@No_Bill" type="SaleBill.No_SaleBill" Index="0" />
- <Param name="@Right" type="SaleBill.ID_Customer" Index="1" />
- </Params>
- <Tables>
- <Table name="SaleNoBillProduct"/>
- </Tables>
- </SearchSaleNoBillProduct>
-
- <SearchTotal CmdType="Text" CmdText="
-
- declare @Sql nvarchar(4000)
- select @Sql = '
- declare @CessOut decimal(5,2)
- Select @CessOut = CessOut_SystemSetting/100 from SystemSetting
- Select * From
- (
- Select SaleBill.No_SaleBill as No_Bill,Convert(datetime,SaleBill.Date_SaleBill) as Date
- ,No_Customer,ShortName_Customer
- ,SaleBill.GetMethod_SaleBill as GetMethod_Bill,convert(nvarchar(64), ' + '''' + '销货单' + '''' + ') as Name_Bill
- ,No_Product,Name_Product
- ,(SaleBillProduct.Quantity_SaleBillProduct-IsNull(A.Quantity_SaleRtnBillProduct,0)) As Quantity_SaleBillProduct
- ,SaleBillProduct.UnitPrice_SaleBillProduct
- ,SaleBill.TaxCurrency_SaleBill
- ,case SaleBill.TaxCurrency_SaleBill
- When ' + '''' + '内含' + '''' +
- 'Then ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)/(1+@CessOut))
- else ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))
- end as MoneyCurrency --未税小计
- ,
- case SaleBill.TaxCurrency_SaleBill
- When ' + '''' + '外加' + '''' +
- 'Then ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(1+@CessOut))
- else ((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))
- end as TaxCurrency --含税小计
- From SaleBill
- LEFT JOIN SaleBillProduct ON SaleBillProduct.ID_SaleBill = SaleBill.ID_SaleBill
- LEFT JOIN Product ON Product.ID_Product = SaleBillProduct.ID_Product
- LEFT JOIN Customer on Customer.ID_Customer = SaleBill.ID_Customer
- Left Join
- (
- SELECT No_FromBill
- ,No_FromBillProduct
- ,Sum(Quantity_SaleRtnBillProduct) As Quantity_SaleRtnBillProduct
- ,Sum(SaleRtnTaxCurrency) As SaleRtnTaxCurrency
- ,Sum(SaleRtnMoneyCurrency) As SaleRtnMoneyCurrency
- From
- (
- Select No_FromBill
- ,No_FromBillProduct
- ,Quantity_SaleRtnBillProduct
- ,case SaleRtnBill.TaxCurrency_SaleRtnBill
- When ' + '''' + '内含' + '''' +
- ' Then (Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)/(1+@CessOut)
- else (Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)
- end as SaleRtnMoneyCurrency
- ,Convert(decimal(18,2),Convert(decimal(18,2),SaleRtnBill.GoodsAmount_SaleRtnBill+SaleRtnBill.TaxAmount_SaleRtnBill)
- ) as SaleRtnTaxCurrency
- From SaleRtnBillProduct
- Join SaleRtnBill ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- Where SaleRtnBill.ID_Assessor Is Not Null
- And SaleRtnBill.Disable_SaleRtnBill = 0
- )InnerA
- Group By No_FromBill,No_FromBillProduct
- )A On A.No_FromBill=SaleBill.No_SaleBill And A.No_FromBillProduct=SaleBillProduct.No_SaleBillProduct
- WHERE (SaleBillProduct.Quantity_SaleBillProduct-IsNull(A.Quantity_SaleRtnBillProduct,0)) > 0
- And SaleBill.ID_Assessor is not null
- And SaleBill.Disable_SaleBill = 0
- and SaleBill.Assess_SaleBill = 0
- AND SaleBillProduct.ID_SaleBill in (Select ID_SaleBill from SaleBill)
- --And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End
- And SaleBill.Date_SaleBill >=' + '''' + '2009-12-21 00:00:01' + '''' +
- ')B
- ' +
- @Where + '
- order by B.No_Bill'
- exec sp_sqlexec @Sql
-
- ">
- <Params>
- <Param name="@Right" type="SaleBill.ID_Customer" Index="0" />
- <Param name="@Where" type="SaleBill.SendAddr_SaleBill" Index="1" />
-
- </Params>
- <Tables>
- <Table name="SaleBillDetail"/>
- </Tables>
- </SearchTotal>
- </Search>
- </Server>
- <Lables>
- <Search>
- </Search>
- <New>
- </New>
- <View>
- </View>
- <Modify>
- </Modify>
- </Lables>
- </Form>
- </Forms>
|