123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420 |
- <?xml version="1.0" encoding="utf-8" ?>
- <Forms>
- <Form Name="FrmUnStrikeInvoiceDetail">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @Title="未冲发票明细";
- GetSchema();
- txtCoNo.CValue=GetCurrentCompanyNo();
- txtCoName.CValue=GetCurrentCompanyShortName();
- Empty();
- NewInstance();
- ComboCompany.Enabled = false;
- dtEnd.Enabled = false;
- ]]>
- </Load>
- <Closing>
- ;
- </Closing>
- <Closed>
- ;
- </Closed>
- </Events>
- <Mode>
- <Search>
- <Lable name="Search"/>
- </Search>
- </Mode>
- <Controls>
- <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>
- <IKCheckBox name="ikCheckEndDate">
- <Events>
- <CheckedChanged>
- dtEnd.Enabled = !dtEnd.Enabled;
- dtEnd.Checked = true;
- </CheckedChanged>
- </Events>
- </IKCheckBox>
- <IKDateTimePicker name = "dtEnd">
- </IKDateTimePicker>
- <IKButton name="btnView">
- <Events>
- <Click>
- <!--UpdateForm(false,"");-->
-
-
- @StartNo_Customer = "";
- @EndNo_Customer = "";
- @Company_Name = "";
- if(tbCustomerNo1.CValue == "")
- {
- MessageBox("请输入客户编号");
- 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("SearchUnStrikeInvoiceDetail",@StartNo_Customer,@EndNo_Customer,@Company_Name);
- if(RowCount("#FrmUnStrikeInvoiceDetail")==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- PrintReport("UIFrmUnStrikeInvoiceDetail","UI","FrmUnStrikeInvoiceDetail");
- }
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnExcel">
- <Events>
- <Click>
- <!--UpdateForm(false,"");-->
- @StartNo_Customer = "";
- @EndNo_Customer = "";
- @Company_Name = "";
- 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("SearchUnStrikeInvoiceDetail",@StartNo_Customer,@EndNo_Customer,@Company_Name);
- if(RowCount("#FrmUnStrikeInvoiceDetail")==0)
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- else
- ExportReport("Excel","UIFrmUnStrikeInvoiceDetail","UI","FrmUnStrikeInvoiceDetail");
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnWord">
- <Events>
- <Click>
- <!--UpdateForm(false,"");-->
- @StartNo_Customer = "";
- @EndNo_Customer = "";
- @Company_Name = "";
- 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("SearchUnStrikeInvoiceDetail",@StartNo_Customer,@EndNo_Customer,@Company_Name);
- if(RowCount("#FrmUnStrikeInvoiceDetail")==0)
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- else
- ExportReport("Word","UIFrmUnStrikeInvoiceDetail","UI","FrmUnStrikeInvoiceDetail");
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnPrint">
- <Events>
- <Click>
- <!--UpdateForm(false,"");-->
- @StartNo_Customer = "";
- @EndNo_Customer = "";
- @Company_Name = "";
- 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("SearchUnStrikeInvoiceDetail",@StartNo_Customer,@EndNo_Customer,@Company_Name);
- if(RowCount("#FrmUnStrikeInvoiceDetail")==0)
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- else
- ExportReport("PrintToPrinter","UIFrmUnStrikeInvoiceDetail","UI","FrmUnStrikeInvoiceDetail");
- </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(nvarchar(32),'') As StartNo_Customer
- ,convert(nvarchar(32),'') As EndNo_Customer
- ,convert(nvarchar(32),'') 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>
- <SearchUnStrikeInvoiceDetail CmdType="Text" CmdText="
-
-
-
- declare @tempTable table
- (
- [No_Customer] nvarchar(32)
- ,[ShortName_Customer] nvarchar(32)
- ,[Company_Customer] nvarchar(32)
- ,[BillPregetMoney] decimal (14,6)
- ,[BillTogetMoney] decimal (14,6)
- ,[BillType] nvarchar(32)
- ,[BillNo] nvarchar(32)
- ,[BillDate] datetime
- ,[BillStrikeMoney] decimal (14,6)
- ,[BillUnStrikeMoney] decimal (14,6)
- )
- declare @CustomerID uniqueidentifier
- declare cur cursor for select ID_Customer from Customer where No_Customer = @StartNo_Customer
- open cur
- fetch next from cur into @CustomerID
- while @@fetch_status = 0
- begin
- insert into @tempTable
- select No_Customer , ShortName_Customer , '' as [Company_Customer] , 0 as [BillPregetMoney], 0 as [BillTogetMoney] , '期初应收款' as BillType , '' as BillNo ,
- CreateDate_Customer as BillDate ,
- abs(isnull([OpeningToGetBalance_Customer],0)) as BillStrikeMoney,
- abs(abs(isnull([OpeningToGetBalance_Customer],0)) - abs(isnull([OpenningBalance_Customer],0))) as BillUnStrikeMoney
- from Customer
- where abs(abs(isnull([OpeningToGetBalance_Customer],0)) - abs(isnull([OpenningBalance_Customer],0))) <> 0
- and ID_Customer = @CustomerID
- union all
- select No_Customer , ShortName_Customer , Company_SaleInvoice as [Company_Customer], 0 as [BillPregetMoney], 0 as [BillTogetMoney] , '发票' as BillType , No_SaleInvoice as BillNo ,
- Date_SaleInvoice as BillDate ,
- isnull([Amount_SaleInvoice],0) as BillStrikeMoney,
- isnull([Amount_SaleInvoice],0)-isnull([StrikedAmount_SaleInvoice],0) as BillUnStrikeMoney
- from SaleInvoice , Customer
- where SaleInvoice.ID_Customer = Customer.ID_Customer
- and isnull([Amount_SaleInvoice],0)-isnull([StrikedAmount_SaleInvoice],0) <> 0
- and Disable_SaleInvoice = 0
- and ID_Assessor is not null
- and Customer.ID_Customer = @CustomerID
- and (@Company_Name = '' or @Company_Name is null or Company_SaleInvoice = @Company_Name)
- fetch next from cur into @CustomerID
- end
- select * from @tempTable
- close cur
- deallocate cur
-
- ">
- <Params>
- <Param name="@StartNo_Customer" type="Customer.No_Customer" Index="0" />
- <Param name="@EndNo_Customer" type="Customer.No_Customer" Index="1" />
- <Param name="@Company_Name" type="Customer.No_Customer" Index="2" />
- </Params>
- <Tables>
- <Table name="FrmUnStrikeInvoiceDetail"/>
- </Tables>
- </SearchUnStrikeInvoiceDetail>
-
- <SearchSaleInvoice CmdType="Text" CmdText=" Declare @ID_Customer uniqueidentifier
- Select @ID_Customer =ID_customer From Customer
- Where No_Customer=@No_Customer
- Declare @Customer Table(ID_Customer Uniqueidentifier)
- Insert Into @Customer Values(@ID_Customer)
- Insert Into @Customer
- Select ID_Customer
- From Customer
- Where CustomerID_Customer = @ID_Customer
-
- Select No_SaleInvoice
- From SaleInvoice
- Where ID_Customer in (Select ID_Customer From @Customer)
- And ID_Assessor is not null
- And Amount_saleinvoice > StrikedAmount_SaleInvoice + DisCountAmount_SaleInvoice
- And PayDate_SaleInvoice < @AssessDate_SaleBill
- And Disable_SaleInvoice = 0
- ">
- <Params>
- <Param name="@No_Customer" type="Customer.No_Customer" Index="0" />
- <Param name="@AssessDate_SaleBill" type="SaleBill.AssessDate_SaleBill" Index="1" />
- </Params>
- <Tables>
- <Table name="SearchSaleInvoice" />
- </Tables>
- </SearchSaleInvoice>
-
- <SearchIsMainCustomer CmdType="Text" CmdText="
- declare @ID uniqueidentifier
- declare @Count int
- select @Count = 0
- select @Count = Count(1) from Customer where No_Customer = @No
- select @ID = CustomerID_Customer from Customer where No_Customer = @No
- if @Count <> 0 and (@ID is null or @ID = '00000000-0000-0000-0000-000000000000')
- select 1
- else
- select * from Customer where 1 = 2
-
- ">
- <Params>
- <Param name="@No" type="Customer.No_Customer" Index="0" />
- </Params>
- <Tables>
- <Table name="SearchIsMainCustomerTemp"/>
- </Tables>
- </SearchIsMainCustomer>
-
- </Search>
- </Server>
- </Form>
- </Forms>
|