123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528 |
- <?xml version="1.0" encoding="utf-8" ?>
- <Forms>
- <Form Name="FrmMonthSalesStatistics">
- <Client>
- <Events>
- <Load>
- <![CDATA[
- @Title="月度销售统计";
- GetSchema();
- txtCoNo.CValue=GetCurrentCompanyNo();
- txtCoName.CValue=GetCurrentCompanyShortName();
- ChangeMode("Search");
- ]]>
- </Load>
-
- <Closing>
- ;
- </Closing>
- <Closed>
- ;
- </Closed>
- </Events>
- <Mode>
- <Search>
- <Lable name="Search"/>
- </Search>
- </Mode>
- <Controls>
- <IKDateTimePicker name="dtpDate" DataSource="UI.dtStart"/>
- <IKTextButton name="tbCustomerNo1" DataSource="UI.StartNo_Customer">
- <Events>
- <Click>
- <![CDATA[
- @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>
- <![CDATA[
- @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo2.CValue);
- if( @temp == "" )
- return;
- tbCustomerNo2.CValue = @temp;
- ]]>
- </Click>
- </Events>
- </IKTextButton>
- <IKComboBoxEx name="cbZone1" DisplaySource="UI.StartZone" DataSource="ZoneType" DisplayMember="Name_TypeDef">
- <Events>
- <Reload>
- UpdateForm(false, "cbZone1");
- Search("SearchZoneType");
- UpdateForm(true, "cbZone1");
- </Reload>
- <TextChanged>
- cbZone2.Text=cbZone1.Text;
- </TextChanged>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbZone2" DisplaySource="UI.EndZone" DataSource="ZoneType" DisplayMember="Name_TypeDef">
- <Events>
- <Reload>
- UpdateForm(false, "cbZone2");
- Search("SearchZoneType");
- UpdateForm(true, "cbZone2");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbPrincipal1" DisplaySource="UI.StartPrincipal_SaleBill" NoSource="UI.StartNo_Principal" DataSource="Principal" DisplayMember="Name_Employee" NoMember="No_Employee">
- <Events>
- <Reload>
- UpdateForm(false, "cbPrincipal1");
- Search("SearchPrincipal");
- UpdateForm(true, "cbPrincipal1");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbPrincipal2" DisplaySource="UI.EndPrincipal_SaleBill" NoSource="UI.EndNo_Principal" DataSource="Principal" DisplayMember="Name_Employee" NoMember="No_Employee">
- <Events>
- <Reload>
- UpdateForm(false, "cbPrincipal2");
- Search("SearchPrincipal");
- UpdateForm(true, "cbPrincipal2");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKButton name="btnView">
- <Events>
- <Click>
- @ClickType="View";
- <Lable name="Action"/>
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnExcel">
- <Events>
- <Click>
- @ClickType="Excel";
- <Lable name="Action"/>
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnWord">
- <Events>
- <Click>
- @ClickType="Word";
- <Lable name="Action"/>
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnPrint">
- <Events>
- <Click>
- @ClickType="PrintToPrinter";
- <Lable name="Action"/>
- </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"/>
- <DataColumn Index="4" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn"/>
- </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 dtStart,convert(nvarchar(64),'') As StartNo_Customer,convert(nvarchar(64),'') As EndNo_Customer,convert(nvarchar(64),'') As StartZone,convert(nvarchar(64),'') As EndZone,
- convert(nvarchar(64),'') As StartNo_Principal,convert(nvarchar(64),'') As EndNo_Principal,convert(nvarchar(64),'') As StartPrincipal_SaleBill,convert(nvarchar(64),'') As EndPrincipal_SaleBill"/>
- </Table>
- </Tables>
- <Search>
-
- <SearchMonthStatistics CmdType="Text" CmdText="
- Select No_Customer,ShortName_Customer,Type_Customer,BeginDate_Customer,Zone_Customer
- ,(IsNull(s1.SumGoodsAmount_SaleBill,0)-IsNull(st1.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount1
- ,(IsNull(s2.SumGoodsAmount_SaleBill,0)-IsNull(st2.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount2
- ,(IsNull(s3.SumGoodsAmount_SaleBill,0)-IsNull(st3.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount3
- ,(IsNull(s4.SumGoodsAmount_SaleBill,0)-IsNull(st4.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount4
- ,(IsNull(s5.SumGoodsAmount_SaleBill,0)-IsNull(st5.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount5
- ,(IsNull(s6.SumGoodsAmount_SaleBill,0)-IsNull(st6.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount6
- ,(IsNull(s7.SumGoodsAmount_SaleBill,0)-IsNull(st7.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount7
- ,(IsNull(s8.SumGoodsAmount_SaleBill,0)-IsNull(st8.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount8
- ,(IsNull(s9.SumGoodsAmount_SaleBill,0)-IsNull(st9.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount9
- ,(IsNull(s10.SumGoodsAmount_SaleBill,0)-IsNull(st10.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount10
- ,(IsNull(s11.SumGoodsAmount_SaleBill,0)-IsNull(st11.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount11
- ,(IsNull(s12.SumGoodsAmount_SaleBill,0)-IsNull(st12.SumGoodsAmount_SaleRtnBill,0)) As SumGoodsAmount12
- From
- Customer
- Left Join
- (
-
- Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
- From SaleBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,@dtStart)<=0 And DateDiff(day,Date_SaleBill,DateAdd(month,1,@dtStart))>0
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )s1 On Customer.ID_Customer=s1.ID_Customer
- Left Join
- (
- Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
- From SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,@dtStart)<=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,1,@dtStart))>0 And @bSaleRtn=1
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )st1 On Customer.ID_Customer=st1.ID_Customer
- Left Join
- (
-
- Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
- From SaleBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,1,@dtStart))<=0 And DateDiff(day,Date_SaleBill,DateAdd(month,2,@dtStart))>0
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )s2 On Customer.ID_Customer=s2.ID_Customer
- Left Join
- (
- Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
- From SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,1,@dtStart))<=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,2,@dtStart))>0 And @bSaleRtn=1
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )st2 On Customer.ID_Customer=st2.ID_Customer
- Left Join
- (
-
- Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
- From SaleBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,2,@dtStart))<=0 And DateDiff(day,Date_SaleBill,DateAdd(month,3,@dtStart))>0
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )s3 On Customer.ID_Customer=s3.ID_Customer
- Left Join
- (
- Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
- From SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,2,@dtStart))<=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,3,@dtStart))>0 And @bSaleRtn=1
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )st3 On Customer.ID_Customer=st3.ID_Customer
- Left Join
- (
-
- Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
- From SaleBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,3,@dtStart))<=0 And DateDiff(day,Date_SaleBill,DateAdd(month,4,@dtStart))>0
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )s4 On Customer.ID_Customer=s4.ID_Customer
- Left Join
- (
- Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
- From SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,3,@dtStart))<=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,4,@dtStart))>0 And @bSaleRtn=1
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )st4 On Customer.ID_Customer=st4.ID_Customer
- Left Join
- (
-
- Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
- From SaleBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,4,@dtStart))<=0 And DateDiff(day,Date_SaleBill,DateAdd(month,5,@dtStart))>0
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )s5 On Customer.ID_Customer=s5.ID_Customer
- Left Join
- (
- Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
- From SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,4,@dtStart))<=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,5,@dtStart))>0 And @bSaleRtn=1
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )st5 On Customer.ID_Customer=st5.ID_Customer
- Left Join
- (
-
- Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
- From SaleBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,5,@dtStart))<=0 And DateDiff(day,Date_SaleBill,DateAdd(month,6,@dtStart))>0
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )s6 On Customer.ID_Customer=s6.ID_Customer
- Left Join
- (
- Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
- From SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,5,@dtStart))<=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,6,@dtStart))>0 And @bSaleRtn=1
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )st6 On Customer.ID_Customer=st6.ID_Customer
- Left Join
- (
-
- Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
- From SaleBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,6,@dtStart))<=0 And DateDiff(day,Date_SaleBill,DateAdd(month,7,@dtStart))>0
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )s7 On Customer.ID_Customer=s7.ID_Customer
- Left Join
- (
- Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
- From SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,6,@dtStart))<=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,7,@dtStart))>0 And @bSaleRtn=1
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )st7 On Customer.ID_Customer=st7.ID_Customer
- Left Join
- (
-
- Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
- From SaleBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,7,@dtStart))<=0 And DateDiff(day,Date_SaleBill,DateAdd(month,8,@dtStart))>0
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )s8 On Customer.ID_Customer=s8.ID_Customer
- Left Join
- (
- Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
- From SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,7,@dtStart))<=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,8,@dtStart))>0 And @bSaleRtn=1
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )st8 On Customer.ID_Customer=st8.ID_Customer
- Left Join
- (
-
- Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
- From SaleBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,8,@dtStart))<=0 And DateDiff(day,Date_SaleBill,DateAdd(month,9,@dtStart))>0
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )s9 On Customer.ID_Customer=s9.ID_Customer
- Left Join
- (
- Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
- From SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,8,@dtStart))<=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,9,@dtStart))>0 And @bSaleRtn=1
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )st9 On Customer.ID_Customer=st9.ID_Customer
- Left Join
- (
-
- Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
- From SaleBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,9,@dtStart))<=0 And DateDiff(day,Date_SaleBill,DateAdd(month,10,@dtStart))>0
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )s10 On Customer.ID_Customer=s10.ID_Customer
- Left Join
- (
- Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
- From SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,9,@dtStart))<=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,10,@dtStart))>0 And @bSaleRtn=1
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )st10 On Customer.ID_Customer=st10.ID_Customer
- Left Join
- (
-
- Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
- From SaleBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,10,@dtStart))<=0 And DateDiff(day,Date_SaleBill,DateAdd(month,11,@dtStart))>0
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )s11 On Customer.ID_Customer=s11.ID_Customer
- Left Join
- (
- Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
- From SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,10,@dtStart))<=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,11,@dtStart))>0 And @bSaleRtn=1
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )st11 On Customer.ID_Customer=st11.ID_Customer
- Left Join
- (
-
- Select ID_Customer,Sum(GoodsAmount_SaleBill) As SumGoodsAmount_SaleBill
- From SaleBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleBill,DateAdd(month,11,@dtStart))<=0 And DateDiff(day,Date_SaleBill,DateAdd(month,12,@dtStart))>0
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )s12 On Customer.ID_Customer=s12.ID_Customer
- Left Join
- (
- Select ID_Customer,Sum(GoodsAmount_SaleRtnBill) As SumGoodsAmount_SaleRtnBill
- From SaleRtnBill
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- Where ID_Assessor Is Not Null And DateDiff(day,Date_SaleRtnBill,DateAdd(month,11,@dtStart))<=0 And DateDiff(day,Date_SaleRtnBill,DateAdd(month,12,@dtStart))>0 And @bSaleRtn=1
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- Group By ID_Customer
- )st12 On Customer.ID_Customer=st12.ID_Customer
-
- Where No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer) And Zone_Customer BETWEEN ISNULL(@StartZone,Zone_Customer) AND ISNULL(@EndZone,Zone_Customer)
- Order By BeginDate_Customer,No_Customer
- ">
- <Params>
- <Param name="@dtStart" type="SaleBill.Date_SaleBill" Index="0" />
- <Param name="@bSaleRtn" type="SaleBill.Disable_SaleBill" Index="1" />
- <Param name="@StartNo_Customer" type="SaleBill.No_Customer" Index="2" />
- <Param name="@EndNo_Customer" type="SaleBill.No_Customer" Index="3" />
- <Param name="@StartZone" type="SaleBill.No_Customer" Index="4" />
- <Param name="@EndZone" type="SaleBill.No_Customer" Index="5" />
- <Param name="@StartNo_Principal" type="Employee.No_Employee" Index="6" />
- <Param name="@EndNo_Principal" type="Employee.No_Employee" Index="7" />
- </Params>
- <Tables>
- <Table name="MonthStatistics"/>
- </Tables>
- </SearchMonthStatistics>
- <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>
- <SearchZoneType CmdType="Text" CmdText="SELECT * FROM TypeDef WHERE Type_TypeDef = 14">
- <Tables>
- <Table name="ZoneType" />
- </Tables>
- </SearchZoneType>
- <SearchPrincipal CmdType="Text" CmdText="
- Select No_Employee,Name_Employee
- From Employee
- ORDER BY No_Employee">
- <Tables>
- <Table name="Principal" />
- </Tables>
- </SearchPrincipal>
- </Search>
- </Server>
- <Lables>
- <Search>
- Empty();
- NewInstance();
- </Search>
- <Action>
- <![CDATA[
- UpdateForm(false,"");
- @StartNo_Customer = DBNull();
- @EndNo_Customer = DBNull();
- @StartZone = DBNull();
- @EndZone = DBNull();
- @StartNo_Principal= DBNull();
- @EndNo_Principal = DBNull();
- if(tbCustomerNo1.CValue != "")
- {
- @StartNo_Customer = tbCustomerNo1.CValue;
- }
- if(cbZone1.Text != "")
- {
- @StartZone = cbZone1.Text;
- }
- if(cbZone2.Text != "")
- {
- @EndZone = cbZone2.Text;
- }
- if(tbCustomerNo2.CValue != "")
- {
- @EndNo_Customer = tbCustomerNo2.CValue;
- }
- if(cbPrincipal1.Text!="")
- {
- if(!cbPrincipal1.CheckSelectedItem())
- {
- MessageBox("请选择有效的业务负责人!",@Title);
- cbPrincipal1.Focus();
- return;
- }
- else
- {
- @StartNo_Principal = cbPrincipal1.SelectedNo;
- }
- }
- if(cbPrincipal2.Text!="")
- {
- if(!cbPrincipal2.CheckSelectedItem())
- {
- MessageBox("请选择有效的业务负责人!",@Title);
- cbPrincipal2.Focus();
- return;
- }
- else
- {
- @EndNo_Principal = cbPrincipal2.SelectedNo;
- }
- }
- Search("SearchMonthStatistics",#UI.dtStart,ckCombine.Checked,@StartNo_Customer,@EndNo_Customer,@StartZone,@EndZone,@StartNo_Principal,@EndNo_Principal);
- if(RowCount("#MonthStatistics")==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- switch(@ClickType)
- {
- case "View":
- PrintReport("UIMonthStatistics","UI","MonthStatistics");
- break;
- default:
- ExportReport(@ClickType,"UIMonthStatistics","UI","MonthStatistics");
- break;
- }
- }
- ]]>
- </Action>
-
- </Lables>
- </Form>
- </Forms>
|