123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501 |
- <?xml version="1.0" encoding="utf-8" ?>
- <Forms>
- <Form Name="FrmReceivableStrikeDetails">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @Title="应收款明细";
- GetSchema();
- txtCoNo.CValue=GetCurrentCompanyNo();
- txtCoName.CValue=GetCurrentCompanyShortName();
- Empty();
- NewInstance();
- #UI.StartDate = GetCurrentTime();
- #UI.EndDate = GetCurrentTime();
- ComboCompany.Enabled = false;
- ]]>
- </Load>
- <Closing>
- ;
- </Closing>
- <Closed>
- ;
- </Closed>
- </Events>
- <Mode>
- <Search>
- <Lable name="Search"/>
- </Search>
- </Mode>
- <Controls>
- <IKDateTimePicker name="dtStart" DataSource="UI.StartDate">
- <Events>
- <CheckedChanged>
- dtEnd.Checked = dtStart.Checked;
- </CheckedChanged>
- <ValueChanged>
- dtEnd.CValue = dtStart.CValue;
- </ValueChanged>
- </Events>
- </IKDateTimePicker>
- <IKDateTimePicker name="dtEnd" DataSource="UI.EndDate"/>
- <IKTextButton name="tbCustomerNo1" DataSource="UI.StartNo_Customer">
- <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" DataSource="UI.EndNo_Customer">
- <Events>
- <Click>
- @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo2.CValue);
- if( @temp == "" )
- return;
- tbCustomerNo2.CValue = @temp;
- </Click>
- </Events>
- </IKTextButton>
- <IKCheckBox name="ikCheckCompany" DataSource="UI.Company_Flag">
- <Events>
- <CheckedChanged>
- ComboCompany.Enabled = !ComboCompany.Enabled;
- </CheckedChanged>
- </Events>
- </IKCheckBox>
- <IKComboBoxEx name="ComboCompany" DisplaySource="UI.Company_Name" DataSource="CompanyType" DisplayMember="Name_TypeDef" >
- <Events>
- <Reload>
- UpdateForm(false, "ComboCompany");
- Search("SearchCompany");
- UpdateForm(true, "ComboCompany");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKButton name="btnView">
- <Events>
- <Click>
- UpdateForm(false,"");
- @StartDate=DBNull();
- @EndDate=DBNull();
- @StartNo_Customer = DBNull();
- @EndNo_Customer = DBNull();
- @Company_Name = "";
- if(dtStart.Checked)
- {
- @StartDate=dtStart.Value;
- }
- else
- {
- MessageBox("统计期间必填!",@Title);
- return;
- }
- if(dtEnd.Checked)
- {
- @EndDate=dtEnd.Value;
- }
- else
- {
- MessageBox("统计期间必填!",@Title);
- return;
- }
- if(tbCustomerNo1.CValue != "")
- @StartNo_Customer = tbCustomerNo1.CValue;
- if(tbCustomerNo2.CValue != "")
- @EndNo_Customer = tbCustomerNo2.CValue;
- if( ikCheckCompany.Checked ){
- if (ComboCompany.Text !=""){
- #UI.company_Name = ComboCompany.Text;
- @Company_Name = ComboCompany.Text;
- }else{
- MessageBox("请选泽所属公司!!");
- #UI.company_Name = "";
- @Company_Name = "";
- return;
- }
- } else {
- #UI.company_Name = "";
- @Company_Name = "";
- }
- Search("SearchReceivableStrikeDetails",@StartDate,@EndDate,@StartNo_Customer,@EndNo_Customer,@Company_Name);
- if(RowCount("#FrmReceivableStrikeDetails")==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- PrintReport("UIFrmReceivableStrikeDetails","UI","FrmReceivableStrikeDetails");
- }
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnExcel">
- <Events>
- <Click>
- UpdateForm(false,"");
- @StartDate=DBNull();
- @EndDate=DBNull();
- @StartNo_Customer = DBNull();
- @EndNo_Customer = DBNull();
- @Company_Name = "";
- if(dtStart.Checked)
- {
- @StartDate=dtStart.Value;
- }
- else
- {
- MessageBox("统计期间必填!",@Title);
- return;
- }
- if(dtEnd.Checked)
- {
- @EndDate=dtEnd.Value;
- }
- else
- {
- MessageBox("统计期间必填!",@Title);
- return;
- }
- if(tbCustomerNo1.CValue != "")
- @StartNo_Customer = tbCustomerNo1.CValue;
- if(tbCustomerNo2.CValue != "")
- @EndNo_Customer = tbCustomerNo2.CValue;
- if( ikCheckCompany.Checked ){
- if (ComboCompany.Text !=""){
- #UI.company_Name = ComboCompany.Text;
- @Company_Name = ComboCompany.Text;
- }else{
- MessageBox("请选泽所属公司!!");
- #UI.company_Name = "";
- @Company_Name = "";
- return;
- }
- } else {
- #UI.company_Name = "";
- @Company_Name = "";
- }
- Search("SearchReceivableStrikeDetails",@StartDate,@EndDate,@StartNo_Customer,@EndNo_Customer,@Company_Name);
- if(RowCount("#FrmReceivableStrikeDetails")==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("Excel","UIFrmReceivableStrikeDetails","UI","FrmReceivableStrikeDetails");
- }
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnWord">
- <Events>
- <Click>
- UpdateForm(false,"");
- @StartDate=DBNull();
- @EndDate=DBNull();
- @StartNo_Customer = DBNull();
- @EndNo_Customer = DBNull();
- @Company_Name = "";
- if(dtStart.Checked)
- {
- @StartDate=dtStart.Value;
- }
- else
- {
- MessageBox("统计期间必填!",@Title);
- return;
- }
- if(dtEnd.Checked)
- {
- @EndDate=dtEnd.Value;
- }
- else
- {
- MessageBox("统计期间必填!",@Title);
- return;
- }
- if(tbCustomerNo1.CValue != "")
- @StartNo_Customer = tbCustomerNo1.CValue;
- if(tbCustomerNo2.CValue != "")
- @EndNo_Customer = tbCustomerNo2.CValue;
- if( ikCheckCompany.Checked ){
- if (ComboCompany.Text !=""){
- #UI.company_Name = ComboCompany.Text;
- @Company_Name = ComboCompany.Text;
- }else{
- MessageBox("请选泽所属公司!!");
- #UI.company_Name = "";
- @Company_Name = "";
- return;
- }
- } else {
- #UI.company_Name = "";
- @Company_Name = "";
- }
- Search("SearchReceivableStrikeDetails",@StartDate,@EndDate,@StartNo_Customer,@EndNo_Customer,@Company_Name);
- if(RowCount("#FrmReceivableStrikeDetails")==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("Word","UIFrmReceivableStrikeDetails","UI","FrmReceivableStrikeDetails");
- }
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnPrint">
- <Events>
- <Click>
- UpdateForm(false,"");
- @StartDate=DBNull();
- @EndDate=DBNull();
- @StartNo_Customer = DBNull();
- @EndNo_Customer = DBNull();
- @Company_Name = "";
- if(dtStart.Checked)
- {
- @StartDate=dtStart.Value;
- }
- else
- {
- MessageBox("统计期间必填!",@Title);
- return;
- }
- if(dtEnd.Checked)
- {
- @EndDate=dtEnd.Value;
- }
- else
- {
- MessageBox("统计期间必填!",@Title);
- return;
- }
- if(tbCustomerNo1.CValue != "")
- @StartNo_Customer = tbCustomerNo1.CValue;
- if(tbCustomerNo2.CValue != "")
- @EndNo_Customer = tbCustomerNo2.CValue;
- if( ikCheckCompany.Checked ){
- if (ComboCompany.Text !=""){
- #UI.company_Name = ComboCompany.Text;
- @Company_Name = ComboCompany.Text;
- }else{
- MessageBox("请选泽所属公司!!");
- #UI.company_Name = "";
- @Company_Name = "";
- return;
- }
- } else {
- #UI.company_Name = "";
- @Company_Name = "";
- }
- Search("SearchReceivableStrikeDetails",@StartDate,@EndDate,@StartNo_Customer,@EndNo_Customer,@Company_Name);
- if(RowCount("#FrmReceivableStrikeDetails")==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("PrintToPrinter","UIFrmReceivableStrikeDetails","UI","FrmReceivableStrikeDetails");
- }
- </Click>
- </Events>
- </IKButton>
- </Controls>
- <ChildForms>
- <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"/>
- </ChildForm>
- </ChildForms>
- <FormatString>
- <Format name="SearchCustomerCondition">
- if(GetRight("客户基本资料","全权查看"))
- {
- FormatString("");
- }
- else
- {
- FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
- }
- </Format>
- </FormatString>
- </Client>
- <Server>
- <Tables>
- <Table name="UI" Type="Parent">
- <GetSchema CmdType="Text" CmdText="Select TOP 0 convert(datetime,0) As StartDate
- ,convert(datetime,0) As EndDate
- ,convert(nvarchar(64),'') As StartNo_Customer
- ,convert(nvarchar(64),'') As EndNo_Customer
- ,convert(nvarchar(64),'') As Company_Name
- ,convert(bit,'false') As Company_Flag"/>
- </Table>
- </Tables>
- <Search>
- <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.ShortName_Customer,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer,Customer.Note_Customer FROM Customer ">
- <Tables>
- <Table name="AllCustomer" />
- </Tables>
- </SearchAllCustomer>
- <SearchCompany CmdType="Text" CmdText="SELECT * FROM TypeDef WHERE Type_TypeDef = 30">
- <Tables>
- <Table name="CompanyType"/>
- </Tables>
- </SearchCompany>
- <SearchReceivableStrikeDetails CmdType="Text" CmdText=" declare @sqlCmd nvarchar(4000)
- set @sqlCmd=N' select * '
- +N' from '
- +N' ( '
- +N' Select No_Customer '
- +N' ,ShortName_Customer '
- +N' ,(case when (OpeningToGetBalance_Customer - OpeningPrepayBalance_Customer + IsNull(B.Big,0) - IsNull(C.Little,0)) = 0 then 0 '
- +N' else (OpeningToGetBalance_Customer - OpeningPrepayBalance_Customer + IsNull(B.Big,0) - IsNull(C.Little,0)) end )'
- +N' As ToGetMoney '
- +N' ,Note_Customer as PreNote'
- +N' ,'''+convert(nvarchar(64),@Company_Name)+N''' as Company'
- +N' From '
- +N' ( '
- +N' Select ID_Customer '
- +N' ,No_Customer '
- +N' ,ShortName_Customer '
- +N' ,OpeningPrePayBalance_Customer '
- +N' ,OpeningToGetBalance_Customer '
- +N' ,Note_Customer '
- +N' ,IsCustomersCustomer_Customer '
- +N' ,Company_Customer'
- +N' From Customer '
- +N' Where ID_Customer Is Not Null '
- +N' And IsCustomersCustomer_Customer = 0 '
- if(@StartNo_Customer Is Not Null)
- set @sqlCmd=@sqlCmd+N' And No_Customer >= '+nchar(39)+@StartNo_Customer+nchar(39)
- if(@EndNo_Customer Is Not Null)
- set @sqlCmd=@sqlCmd+N' And No_Customer <= '+nchar(39)+@EndNo_Customer+nchar(39)
-
- if(@Company_Name Is Not Null)
- if (@Company_Name!='')
- set @sqlCmd=@sqlCmd+N' And Company_Customer = '+nchar(39)+@Company_Name+nchar(39)
-
- set @sqlCmd=@sqlCmd+N' ) A '
- +N' Left Join '
- +N' ( '
- +N' Select ID_Customer,Sum(Amount_SaleInvoice) As Big '
- +N' From SaleInvoice '
- +N' Where SaleInvoice.ID_Assessor Is Not Null '
- +N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@StartDate)+nchar(39)+N',InvoiceDate_SaleInvoice) <0 '
- +N' And Disable_SaleInvoice = 0 '
- +N' Group By ID_Customer '
- +N' )B On B.ID_Customer = A.ID_Customer '
- +N' Left Join '
- +N' ( '
- +N' Select ID_Customer,Sum(Amount_Preget) As Little '
- +N' From Preget '
- +N' Where PreGet.ID_Assessor Is Not Null '
- +N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@StartDate)+nchar(39)+N',Date_PreGet) < 0 '
- +N' Group By ID_Customer '
- +N' )C On C.ID_Customer = A.ID_Customer '
- +N' )x '
- +N' left join '
- +N' ( '
- +N' Select No_Customer As No_Customer2 '
- +N' ,'+nchar(39)+'发票'+nchar(39)+N' As BillType '
- +N' ,No_Invoice As BillNo '
- +N' ,InvoiceDate_SaleInvoice As BillDate '
- +N' ,IsNull(Amount_SaleInvoice,0) As BillMoney '
- +N' ,NULL As PrePayMoney '
- +N' ,NULL As BillNote '
- +N' From SaleInvoice'
- +N' Left Join Customer On SaleInvoice.ID_Customer = Customer.ID_Customer '
- +N' Where SaleInvoice.ID_Assessor Is Not Null '
- +N' and InvoiceDate_SaleInvoice is not null '
- +N' And Disable_SaleInvoice = 0 '
- if(@StartDate Is Not Null)
- set @sqlCmd=@sqlCmd+N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@StartDate)+nchar(39)+N',InvoiceDate_SaleInvoice) >=0 '
- if(@EndDate Is Not Null)
- set @sqlCmd=@sqlCmd+N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@EndDate)+nchar(39)+N',InvoiceDate_SaleInvoice) <=0 '
- if(@StartNo_Customer Is Not Null)
- set @sqlCmd=@sqlCmd+N' And No_Customer >= '+nchar(39)+@StartNo_Customer+nchar(39)
- if(@EndNo_Customer Is Not Null)
- set @sqlCmd=@sqlCmd+N' And No_Customer <= '+nchar(39)+@EndNo_Customer+nchar(39)
- set @sqlCmd=@sqlCmd+N' Union All '
- +N' Select No_Customer As No_Customer2'
- +N' ,'+nchar(39)+'收款'+nchar(39)+N' As BillType '
- +N' ,No_PreGet As BillNo '
- +N' ,Date_PreGet As BillDate '
- +N' ,NULL As BillMoney '
- +N' ,IsNull(Amount_PreGet,0) As PrePayMoney '
- +N' ,Comment_PreGet As BillNote '
- +N' From PreGet '
- +N' Left Join Customer On PreGet.ID_Customer = Customer.ID_Customer '
- +N' Where PreGet.ID_Assessor Is Not Null '
- if(@StartDate Is Not Null)
- set @sqlCmd=@sqlCmd+N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@StartDate)+nchar(39)+N',Date_PreGet) >=0 '
- if(@EndDate Is Not Null)
- set @sqlCmd=@sqlCmd+N' And DateDiff(day,'+nchar(39)+convert(nvarchar(64),@EndDate)+nchar(39)+N',Date_PreGet) <=0 '
- if(@StartNo_Customer Is Not Null)
- set @sqlCmd=@sqlCmd+N' And No_Customer >= '+nchar(39)+@StartNo_Customer+nchar(39)
- if(@EndNo_Customer Is Not Null)
- set @sqlCmd=@sqlCmd+N' And No_Customer <= '+nchar(39)+@EndNo_Customer+nchar(39)
- set @sqlCmd=@sqlCmd+N' )y on y.No_Customer2 = x.No_Customer '
- set @sqlCmd=@sqlCmd+N' Order By No_Customer,BillDate'
- EXECUTE sp_executesql @sqlCmd">
- <Params>
- <Param name="@StartDate" type="SaleInvoice.InvoiceDate_SaleInvoice" Index="0" />
- <Param name="@EndDate" type="SaleInvoice.InvoiceDate_SaleInvoice" Index="1" />
- <Param name="@StartNo_Customer" type="Customer.No_Customer" Index="2" />
- <Param name="@EndNo_Customer" type="Customer.No_Customer" Index="3" />
- <Param name="@Company_Name" type="Customer.No_Customer" Index="4" />
- </Params>
- <Tables>
- <Table name="FrmReceivableStrikeDetails"/>
- </Tables>
- </SearchReceivableStrikeDetails>
- </Search>
- </Server>
- </Form>
- </Forms>
|