123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410 |
- <?xml version="1.0" encoding="UTF-8"?>
- <Forms>
- <Form Name="FrmReceivablesAnalysis">
- <Client>
- <Events>
- <Load><![CDATA[
- @Title="应收帐款帐龄分析";
- GetSchema();
- txtCoNo.CValue=GetCurrentCompanyNo();
- txtCoName.CValue=GetCurrentCompanyShortName();
- Empty();
- ikTextBox2.Text="100000000.00";
- ]]></Load>
- <Closing>
- ;
- </Closing>
- <Closed>
- ;
- </Closed>
- </Events>
- <Mode>
- <Search>
- <Lable name="Search"/>
- </Search>
- </Mode>
- <Controls>
- <IKTextButton name="tbCustomerNo1" >
- <Events>
- <Click>
- @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo1.CValue);
- if( @temp == "" )
- return;
- tbCustomerNo1.CValue = @temp;
- </Click>
- <TextBoxButtonTextChanged>
- tbCustomerNo2.CValue = tbCustomerNo1.CValue;
- </TextBoxButtonTextChanged>
- </Events>
- </IKTextButton>
- <IKTextButton name="tbCustomerNo2" >
- <Events>
- <Click>
- @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo2.CValue);
- if( @temp == "" )
- return;
- tbCustomerNo2.CValue = @temp;
- </Click>
- </Events>
- </IKTextButton>
-
- <IKTextButton name="tbSaleInvoiceNo1" >
- <Events>
- <Click>
- @temp = ShowSearchBox("SaleInvoiceNoSearch","NODEPOT","tbSaleInvoiceNo1",tbSaleInvoiceNo1.CValue);
- if( @temp == "" )
- return;
- tbSaleInvoiceNo1.CValue = @temp;
- </Click>
- <TextBoxButtonTextChanged>
- tbSaleInvoiceNo2.CValue = tbSaleInvoiceNo1.CValue;
- </TextBoxButtonTextChanged>
- </Events>
- </IKTextButton>
- <IKTextButton name="tbSaleInvoiceNo2" >
- <Events>
- <Click>
- @temp = ShowSearchBox("SaleInvoiceNoSearch","NODEPOT","tbSaleInvoiceNo2", tbSaleInvoiceNo2.CValue);
- if( @temp == "" )
- return;
- tbSaleInvoiceNo2.CValue = @temp;
- </Click>
- </Events>
- </IKTextButton>
-
- <IKTextButton name="tbInvoiceNo1" >
- <Events>
- <Click>
- @temp = ShowSearchBox("InvoiceNoSearch","NODEPOT","tbInvoiceNo1", tbInvoiceNo1.CValue);
- if( @temp == "" )
- return;
- tbInvoiceNo1.CValue = @temp;
- </Click>
- <TextBoxButtonTextChanged>
- tbInvoiceNo2.CValue = tbInvoiceNo1.CValue;
- </TextBoxButtonTextChanged>
- </Events>
- </IKTextButton>
- <IKTextButton name="tbInvoiceNo2" >
- <Events>
- <Click>
- @temp = ShowSearchBox("InvoiceNoSearch","NODEPOT","tbInvoiceNo2", tbInvoiceNo2.CValue);
- if( @temp == "" )
- return;
- tbInvoiceNo2.CValue = @temp;
- </Click>
- </Events>
- </IKTextButton>
-
- <IKButton name="btnView">
- <Events>
- <Click>
- Empty();
- @StartNo_Customer = DBNull();
- @EndNo_Customer = DBNull();
- @StartToGetBalance_Customer=DBNull();
- @EndToGetBalance_Customer=DBNull();
- @StartNo_SaleInvoice = DBNull();
- @EndNo_SaleInvoice = DBNull();
- @StartNo_Invoice = DBNull();
- @EndNo_Invoice = DBNull();
- if(tbCustomerNo1.CValue != "")
- @StartNo_Customer = tbCustomerNo1.CValue;
- if(tbCustomerNo2.CValue != "")
- @EndNo_Customer = tbCustomerNo2.CValue;
-
- @StartToGetBalance_Customer=ikTextBox1.CValue;
-
- @EndToGetBalance_Customer=ikTextBox2.CValue;
- if(tbSaleInvoiceNo1.CValue!="")
- @StartNo_SaleInvoice=tbSaleInvoiceNo1.CValue;
- if(tbSaleInvoiceNo2.CValue!="")
- @EndNo_SaleInvoice=tbSaleInvoiceNo2.CValue;
- if(tbInvoiceNo1.CValue!="")
- @StartNo_Invoice=tbInvoiceNo1.CValue;
- if(tbInvoiceNo2.CValue!="")
- @EndNo_Invoice=tbInvoiceNo2.CValue;
- Search("SearchReceivablesAnalysis",@StartNo_Customer,@EndNo_Customer,@StartToGetBalance_Customer,@EndToGetBalance_Customer,@StartNo_SaleInvoice,
- @EndNo_SaleInvoice,@StartNo_Invoice,@EndNo_Invoice,DateTimeNow(),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- if(RowCount("#FrmReceivablesAnalysis") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- PrintReport("FrmReceivablesAnalysis","FrmReceivablesAnalysis");
- }
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnExcel">
- <Events>
- <Click>
- Empty();
- @StartNo_Customer = DBNull();
- @EndNo_Customer = DBNull();
- @StartToGetBalance_Customer=DBNull();
- @EndToGetBalance_Customer=DBNull();
- @StartNo_SaleInvoice = DBNull();
- @EndNo_SaleInvoice = DBNull();
- @StartNo_Invoice = DBNull();
- @EndNo_Invoice = DBNull();
- if(tbCustomerNo1.CValue != "")
- @StartNo_Customer = tbCustomerNo1.CValue;
- if(tbCustomerNo2.CValue != "")
- @EndNo_Customer = tbCustomerNo2.CValue;
-
- @StartToGetBalance_Customer=ikTextBox1.CValue;
-
- @EndToGetBalance_Customer=ikTextBox2.CValue;
- if(tbSaleInvoiceNo1.CValue!="")
- @StartNo_SaleInvoice=tbSaleInvoiceNo1.CValue;
- if(tbSaleInvoiceNo2.CValue!="")
- @EndNo_SaleInvoice=tbSaleInvoiceNo2.CValue;
- if(tbInvoiceNo1.CValue!="")
- @StartNo_Invoice=tbInvoiceNo1.CValue;
- if(tbInvoiceNo2.CValue!="")
- @EndNo_Invoice=tbInvoiceNo2.CValue;
- Search("SearchReceivablesAnalysis",@StartNo_Customer,@EndNo_Customer,@StartToGetBalance_Customer,@EndToGetBalance_Customer,@StartNo_SaleInvoice,
- @EndNo_SaleInvoice,@StartNo_Invoice,@EndNo_Invoice,DateTimeNow(),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- if(RowCount("#FrmReceivablesAnalysis") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("Excel","FrmReceivablesAnalysis","FrmReceivablesAnalysis");
- }
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnWord">
- <Events>
- <Click>
- Empty();
- @StartNo_Customer = DBNull();
- @EndNo_Customer = DBNull();
- @StartToGetBalance_Customer=DBNull();
- @EndToGetBalance_Customer=DBNull();
- @StartNo_SaleInvoice = DBNull();
- @EndNo_SaleInvoice = DBNull();
- @StartNo_Invoice = DBNull();
- @EndNo_Invoice = DBNull();
- if(tbCustomerNo1.CValue != "")
- @StartNo_Customer = tbCustomerNo1.CValue;
- if(tbCustomerNo2.CValue != "")
- @EndNo_Customer = tbCustomerNo2.CValue;
-
- @StartToGetBalance_Customer=ikTextBox1.CValue;
-
- @EndToGetBalance_Customer=ikTextBox2.CValue;
- if(tbSaleInvoiceNo1.CValue!="")
- @StartNo_SaleInvoice=tbSaleInvoiceNo1.CValue;
- if(tbSaleInvoiceNo2.CValue!="")
- @EndNo_SaleInvoice=tbSaleInvoiceNo2.CValue;
- if(tbInvoiceNo1.CValue!="")
- @StartNo_Invoice=tbInvoiceNo1.CValue;
- if(tbInvoiceNo2.CValue!="")
- @EndNo_Invoice=tbInvoiceNo2.CValue;
- Search("SearchReceivablesAnalysis",@StartNo_Customer,@EndNo_Customer,@StartToGetBalance_Customer,@EndToGetBalance_Customer,@StartNo_SaleInvoice,
- @EndNo_SaleInvoice,@StartNo_Invoice,@EndNo_Invoice,DateTimeNow(),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- if(RowCount("#FrmReceivablesAnalysis") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("Word","FrmReceivablesAnalysis","FrmReceivablesAnalysis");
- }
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnPrint">
- <Events>
- <Click>
- Empty();
- @StartNo_Customer = DBNull();
- @EndNo_Customer = DBNull();
- @StartToGetBalance_Customer=DBNull();
- @EndToGetBalance_Customer=DBNull();
- @StartNo_SaleInvoice = DBNull();
- @EndNo_SaleInvoice = DBNull();
- @StartNo_Invoice = DBNull();
- @EndNo_Invoice = DBNull();
- if(tbCustomerNo1.CValue != "")
- @StartNo_Customer = tbCustomerNo1.CValue;
- if(tbCustomerNo2.CValue != "")
- @EndNo_Customer = tbCustomerNo2.CValue;
-
- @StartToGetBalance_Customer=ikTextBox1.CValue;
-
- @EndToGetBalance_Customer=ikTextBox2.CValue;
- if(tbSaleInvoiceNo1.CValue!="")
- @StartNo_SaleInvoice=tbSaleInvoiceNo1.CValue;
- if(tbSaleInvoiceNo2.CValue!="")
- @EndNo_SaleInvoice=tbSaleInvoiceNo2.CValue;
- if(tbInvoiceNo1.CValue!="")
- @StartNo_Invoice=tbInvoiceNo1.CValue;
- if(tbInvoiceNo2.CValue!="")
- @EndNo_Invoice=tbInvoiceNo2.CValue;
- Search("SearchReceivablesAnalysis",@StartNo_Customer,@EndNo_Customer,@StartToGetBalance_Customer,@EndToGetBalance_Customer,@StartNo_SaleInvoice,
- @EndNo_SaleInvoice,@StartNo_Invoice,@EndNo_Invoice,DateTimeNow(),GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID());
- if(RowCount("#FrmReceivablesAnalysis") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("PrintToPrinter","FrmReceivablesAnalysis","FrmReceivablesAnalysis");
- }
- </Click>
- </Events>
- </IKButton>
- </Controls>
- <ChildForms>
- <ChildForm name="SaleInvoiceNoSearch" DataSource="SaleInvoice" SearchFunction="SearchAllSaleInvoiceNo" SearchFunctionCondition="SearchCustomerCondition" SearchFunctionByNo="">
- <DataColumn Index="0" MappingName="#SaleInvoice.No_SaleInvoice" HeaderText="销项发票单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#SaleInvoice.Date_SaleInvoice" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#SaleInvoice.ShortName_Customer" HeaderText="客户简称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionCondition="SearchCustomerCondition" SearchFunctionByNo="" MappingName="客户">
- <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="4" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn"/>
- </ChildForm>
- <ChildForm name="InvoiceNoSearch" DataSource="SaleInvoice" SearchFunction="SearchAllInvoiceNo" SearchFunctionByNo="" MappingName="发票编号">
- <DataColumn Index="0" MappingName="#SaleInvoice.No_Invoice" HeaderText="发票编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#SaleInvoice.InvoiceDate_SaleInvoice" HeaderText="发票日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- </ChildForms>
- <FormatString>
- <Format name="SearchCustomerCondition">
- if(GetRight("客户基本资料","全权查看"))
- {
- FormatString("");
- }
- else
- {
- FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
- }
- </Format>
- </FormatString>
- </Client>
- <Server>
- <!--<Tables>
- <Table name="FrmReceivablesAnalysis">
- <GetSchema CmdType="Text" CmdText="
- Select Top 0 No_Customer,ShortName_Customer,convert(decimal(14,4),0) As Total,convert(decimal(14,4),0) As NotPast,convert(decimal(14,4),0) As InOne,convert(decimal(14,4),0) As InTwo,convert(decimal(14,4),0) As InThree,convert(decimal(14,4),0) As PastThree,convert(nvarchar(32),'') As IsSuspend
- From Customer
- ">
- </GetSchema>
- </Table>
- </Tables>-->
- <Search>
- <SearchAllSaleInvoiceNo CmdType="Text" CmdText="
- Select SaleInvoice.No_SaleInvoice,SaleInvoice.Date_SaleInvoice,Customer.ShortName_Customer,Customer.ID_Creator
- From SaleInvoice
- Join Customer ON Customer.ID_Customer=SaleInvoice.ID_Customer
- ">
- <Tables>
- <Table name="AllSaleInvoiceNo" />
- </Tables>
- </SearchAllSaleInvoiceNo>
- <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.ShortName_Customer,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer FROM Customer ">
- <Tables>
- <Table name="AllCustomer" />
- </Tables>
- </SearchAllCustomer>
- <SearchAllInvoiceNo CmdType="Text" CmdText="SELECT No_Invoice,InvoiceDate_SaleInvoice FROM SaleInvoice">
- <Tables>
- <Table name="AllInvoiceNo" />
- </Tables>
- </SearchAllInvoiceNo>
- <SearchReceivablesAnalysis CmdType="Text" CmdText="
- Select No_Customer,ShortName_Customer,(ToGetBalance_Customer-(IsNull(NotPast,0)+IsNull(InOne,0)+IsNull(InTwo,0)+IsNull(InThree,0)+IsNull(PastThree,0))) As OpeningMoney,(IsNull(NotPast,0)+IsNull(InOne,0)+IsNull(InTwo,0)+IsNull(InThree,0)+IsNull(PastThree,0)) As Total,IsNull(NotPast,0) As NotPast,IsNull(InOne,0) As InOne,IsNull(InTwo,0) As InTwo,IsNull(InThree,0) As InThree,IsNull(PastThree,0) As PastThree,IsSuspend=case IsNull(SuspendDate_Customer,0) when 0 Then '否' else '是' end
- From Customer
- Left Join
- (
- Select SaleInvoice.ID_Customer,Sum(Amount_SaleInvoice-StrikedAmount_SaleInvoice) As NotPast
- From SaleInvoice
-
- Where DateDiff(day,PayDate_SaleInvoice,@currentDate) <=0
- And SaleInvoice.ID_Assessor Is Not Null And Disable_SaleInvoice=0
- And SaleInvoice.No_SaleInvoice between IsNull(@StartNo_SaleInvoice,'') And IsNull(@EndNo_SaleInvoice,(Select Max(No_SaleInvoice) From SaleInvoice))
- And IsNull(SaleInvoice.No_Invoice,'') between IsNull(@StartNo_Invoice,'') And IsNull(@EndNo_Invoice,(Select Max(No_Invoice) From SaleInvoice))
- Group By ID_Customer
- )a On a.ID_Customer=Customer.ID_Customer
- Left Join
- (
- Select SaleInvoice.ID_Customer,Sum(Amount_SaleInvoice-StrikedAmount_SaleInvoice) As InOne
- From SaleInvoice
-
- Where DateDiff(day,PayDate_SaleInvoice,@currentDate) > 0 And DateDiff(day,DateAdd(month,1,PayDate_SaleInvoice),@currentDate) <= 0
- And SaleInvoice.ID_Assessor Is Not Null And Disable_SaleInvoice=0
- And SaleInvoice.No_SaleInvoice between IsNull(@StartNo_SaleInvoice,'') And IsNull(@EndNo_SaleInvoice,(Select Max(No_SaleInvoice) From SaleInvoice))
- And IsNull(SaleInvoice.No_Invoice,'') between IsNull(@StartNo_Invoice,'') And IsNull(@EndNo_Invoice,(Select Max(No_Invoice) From SaleInvoice))
- Group By ID_Customer
- )b On b.ID_Customer=Customer.ID_Customer
- Left Join
- (
- Select SaleInvoice.ID_Customer,Sum(Amount_SaleInvoice-StrikedAmount_SaleInvoice) As InTwo
- From SaleInvoice
-
- Where DateDiff(day,DateAdd(month,1,PayDate_SaleInvoice),@currentDate) > 0 And DateDiff(day,DateAdd(month,2,PayDate_SaleInvoice),@currentDate) <= 0
- And SaleInvoice.ID_Assessor Is Not Null And Disable_SaleInvoice=0
- And SaleInvoice.No_SaleInvoice between IsNull(@StartNo_SaleInvoice,'') And IsNull(@EndNo_SaleInvoice,(Select Max(No_SaleInvoice) From SaleInvoice))
- And IsNull(SaleInvoice.No_Invoice,'') between IsNull(@StartNo_Invoice,'') And IsNull(@EndNo_Invoice,(Select Max(No_Invoice) From SaleInvoice))
- Group By ID_Customer
- )c On c.ID_Customer=Customer.ID_Customer
- Left Join
- (
- Select SaleInvoice.ID_Customer,Sum(Amount_SaleInvoice-StrikedAmount_SaleInvoice) As InThree
- From SaleInvoice
-
- Where DateDiff(day,DateAdd(month,2,PayDate_SaleInvoice),@currentDate) > 0 And DateDiff(day,DateAdd(month,3,PayDate_SaleInvoice),@currentDate) <= 0
- And SaleInvoice.ID_Assessor Is Not Null And Disable_SaleInvoice=0
- And SaleInvoice.No_SaleInvoice between IsNull(@StartNo_SaleInvoice,'') And IsNull(@EndNo_SaleInvoice,(Select Max(No_SaleInvoice) From SaleInvoice))
- And IsNull(SaleInvoice.No_Invoice,'') between IsNull(@StartNo_Invoice,'') And IsNull(@EndNo_Invoice,(Select Max(No_Invoice) From SaleInvoice))
- Group By ID_Customer
- )d On d.ID_Customer=Customer.ID_Customer
- Left Join
- (
- Select SaleInvoice.ID_Customer,Sum(Amount_SaleInvoice-StrikedAmount_SaleInvoice) As PastThree
- From SaleInvoice
-
- Where DateDiff(day,DateAdd(month,3,PayDate_SaleInvoice),@currentDate) > 0
- And SaleInvoice.ID_Assessor Is Not Null And Disable_SaleInvoice=0
- And SaleInvoice.No_SaleInvoice between IsNull(@StartNo_SaleInvoice,'') And IsNull(@EndNo_SaleInvoice,(Select Max(No_SaleInvoice) From SaleInvoice))
- And IsNull(SaleInvoice.No_Invoice,'') between IsNull(@StartNo_Invoice,'') And IsNull(@EndNo_Invoice,(Select Max(No_Invoice) From SaleInvoice))
- Group By ID_Customer
- )e On e.ID_Customer=Customer.ID_Customer
- Where No_Customer between IsNull(@StartNo_Customer,'') And IsNull(@EndNo_Customer,(Select Max(No_Customer) From Customer))
- And Customer.ID_Creator=case IsNull(DataLength(@Right),0) When 0 Then Customer.ID_Creator Else @Right End --added for validating right
- And ToGetBalance_Customer between IsNull(@StartToGetBalance_Customer,0) And IsNull(@EndToGetBalance_Customer,(Select Max(ToGetBalance_Customer) From Customer))
- Order By No_Customer
- ">
- <Params>
- <Param name="@StartNo_Customer" type="Customer.No_Customer" Index="0" />
- <Param name="@EndNo_Customer" type="Customer.No_Customer" Index="1" />
- <Param name="@StartToGetBalance_Customer" type="Customer.ToGetBalance_Customer" Index="2" />
- <Param name="@EndToGetBalance_Customer" type="Customer.ToGetBalance_Customer" Index="3" />
- <Param name="@StartNo_SaleInvoice" type="SaleInvoice.No_SaleInvoice" Index="4" />
- <Param name="@EndNo_SaleInvoice" type="SaleInvoice.No_SaleInvoice" Index="5" />
- <Param name="@StartNo_Invoice" type="SaleInvoice.No_Invoice" Index="6" />
- <Param name="@EndNo_Invoice" type="SaleInvoice.No_Invoice" Index="7" />
- <Param name="@currentDate" type="SaleInvoice.PayDate_SaleInvoice" Index="8" />
- <Param name="@Right" type="SaleBill.ID_Customer" Index="9" />
- </Params>
- <Tables>
- <Table name="FrmReceivablesAnalysis"/>
- </Tables>
- </SearchReceivablesAnalysis>
- </Search>
- </Server>
- </Form>
- </Forms>
-
-
-
|