123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464 |
- <?xml version="1.0" encoding="UTF-8"?>
- <Forms>
- <Form Name="FrmSalesList">
- <Client>
- <Events>
- <Load><![CDATA[
- @Title="销货明细表";
- GetSchema();
- txtCoNo.CValue=GetCurrentCompanyNo();
- txtCoName.CValue=GetCurrentCompanyShortName();
- Empty();
- NewInstance();
- dtStart.CValue=GetCurrentTime();
- dtEnd.CValue=GetCurrentTime();
- ]]></Load>
- <Closing>
- ;
- </Closing>
- <Closed>
- ;
- </Closed>
- </Events>
- <Mode>
- <Search>
- <Lable name="Search"/>
- </Search>
- </Mode>
- <Controls>
- <IKDateTimePicker name = "dtStart">
- <Events>
- <CheckedChanged>
- dtEnd.Checked = dtStart.Checked;
- </CheckedChanged>
- <ValueChanged>
- dtEnd.CValue = dtStart.CValue;
- </ValueChanged>
- </Events>
-
- </IKDateTimePicker>
- <IKTextButton name="tbSaleBillNo1" >
- <Events>
- <Click>
- ShowSearchBox("BillSearch","HAVEDEPOT", "tbSaleBillNo1",tbSaleBillNo1.CValue);
- </Click>
- <TextBoxButtonTextChanged>
- tbSaleBillNo2.CValue = tbSaleBillNo1.CValue;
- </TextBoxButtonTextChanged>
- </Events>
- </IKTextButton>
- <IKTextButton name="tbSaleBillNo2" >
- <Events>
- <Click>
- ShowSearchBox("BillSearch","HAVEDEPOT", "tbSaleBillNo2",tbSaleBillNo2.CValue);
- </Click>
- </Events>
- </IKTextButton>
- <IKTextButton name="tbCustomerNo1" >
- <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" >
- <Events>
- <Click>
- <![CDATA[
- @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo2.CValue);
- if( @temp == "" )
- return;
- tbCustomerNo2.CValue = @temp;
- ]]>
- </Click>
- </Events>
- </IKTextButton>
-
- <IKComboBoxEx name="cbPrincipal1" DataSource="Principal" DisplayMember="Name_Employee" NoMember="No_Employee">
- <Events>
- <Reload>
- UpdateForm(false, "cbPrincipal1");
- Search("SearchPrincipal");
- UpdateForm(true, "cbPrincipal1");
- </Reload>
- <TextChanged>
- cbPrincipal2.SelectedName = cbPrincipal1.SelectedName;
- cbPrincipal2.SelectedNo=cbPrincipal1.SelectedNo;
- </TextChanged>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbPrincipal2" DataSource="Principal" DisplayMember="Name_Employee" NoMember="No_Employee">
- <Events>
- <Reload>
- UpdateForm(false, "cbPrincipal2");
- Search("SearchPrincipal");
- UpdateForm(true, "cbPrincipal2");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbLocation1" DataSource="Location" DisplayMember="Name_Location" NoMember="No_Location" >
- <Events>
- <Reload>
- UpdateForm(false, "cbLocation1");
- Search("SearchLocation");
- UpdateForm(true, "cbLocation1");
- </Reload>
- <TextChanged>
- cbLocation2.SelectedName = cbLocation1.SelectedName;
- cbLocation2.SelectedNo = cbLocation1.SelectedNo;
- </TextChanged>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbLocation2" DataSource="Location" DisplayMember="Name_Location" NoMember="No_Location">
- <Events>
- <Reload>
- UpdateForm(false, "cbLocation2");
- Search("SearchLocation");
- UpdateForm(true, "cbLocation2");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKTextButton name="tbProduct1" >
- <Events>
- <Click>
- <![CDATA[
- @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProduct1.CValue);
- if( @temp == "" )
- return;
- tbProduct1.CValue = @temp;
- ]]>
- </Click>
- <TextBoxButtonTextChanged>
- tbProduct2.CValue = tbProduct1.CValue;
- </TextBoxButtonTextChanged>
- </Events>
-
- </IKTextButton>
- <IKTextButton name="tbProduct2" >
- <Events>
- <Click>
- <![CDATA[
- @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProduct2.CValue);
- if( @temp == "" )
- return;
- tbProduct2.CValue = @temp;
- ]]>
- </Click>
- </Events>
- </IKTextButton>
- <IKComboBoxEx name="cbType1" DataSource="Type" DisplayMember="Type_Product" >
- <Events>
- <Reload>
- UpdateForm(false, "cbType1");
- Search("SearchType");
- UpdateForm(true, "cbType1");
- </Reload>
- <TextChanged>
- cbType2.Text = cbType1.Text;
- </TextChanged>
- </Events>
- </IKComboBoxEx>
- <IKComboBoxEx name="cbType2" DataSource="Type" DisplayMember="Type_Product" >
- <Events>
- <Reload>
- UpdateForm(false, "cbType2");
- Search("SearchType");
- UpdateForm(true, "cbType2");
- </Reload>
- </Events>
- </IKComboBoxEx>
- <IKButton name="btnView">
- <Events>
- <Click>
- <![CDATA[
- if(ikRadioButton1.Checked==false && ikRadioButton2.Checked==false && ikRadioButton3.Checked==false && ikRadioButton4.Checked==false && ikRadioButton5.Checked==false)
- {
- MessageBox("请选择格式!",@Title);
- return;
- }
- Empty();
- @Company=GetCurrentCompanyNo();
- @Name_Create = GetCurrentUser();
- @StartDate = DBNull();
- @EndDate = DBNull();
- @StartNo_SaleBill = DBNull();
- @EndNo_SaleBill = DBNull();
- @StartNo_Customer = DBNull();
- @EndNo_Customer = DBNull();
- @StartNo_Principal = DBNull();
- @EndNo_Principal = DBNull();
- @StartNo_Location = DBNull();
- @EndNo_Location = DBNull();
- @StartNo_Product = DBNull();
- @EndNo_Product = DBNull();
- @StartType_Product = DBNull();
- @EndType_Product = DBNull();
- @Rtn = 0;
- if(ikRtnCheck.Checked)
- {
- @Rtn = 1;
- }
- if(dtStart.Checked==true)
- @StartDate = dtStart.CValue;
- if(dtEnd.Checked==true)
- @EndDate = dtEnd.CValue;
- if(tbSaleBillNo1.CValue != "")
- {@StartNo_SaleBill = tbSaleBillNo1.CValue;
- }
- if(tbSaleBillNo2.CValue != "")
- {@EndNo_SaleBill = tbSaleBillNo2.CValue;
- }
- if(tbCustomerNo1.CValue != "")
- {@StartNo_Customer = tbCustomerNo1.CValue;
- }
- 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;
- }
- }
- if(cbLocation1.Text!="")
- {
- if(!cbLocation1.CheckSelectedItem())
- {
- MessageBox("请选择有效的仓库!",@Title);
- cbLocation1.Focus();
- return;
- }
- else
- {
- @StartNo_Location = cbLocation1.SelectedNo;
- }
- }
- if(cbLocation2.Text!="")
- {
- if(!cbLocation2.CheckSelectedItem())
- {
- MessageBox("请选择有效的仓库!",@Title);
- cbLocation2.Focus();
- return;
- }
- else
- {
- @EndNo_Location = cbLocation2.SelectedNo;
- }
- }
- if(tbProduct1.CValue != "")
- @StartNo_Product = tbProduct1.CValue;
- if(tbProduct2.CValue != "")
- @EndNo_Product = tbProduct2.CValue;
- if(cbType1.Text != "")
- @StartType_Product = cbType1.Text;
- if(cbType2.Text != "")
- @EndType_Product = cbType2.Text;
- if(ikRadioButton4.Checked)
- {
- Search("SearchFrmSalesListLocation",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesListLocation")==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- PrintReport("GetFrmSalesListLocation","Get","FrmSalesListLocation");
- }
- }
- if(ikRadioButton2.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- PrintReport("GetFrmSalesListProduct","Get","FrmSalesList");
- }
- }
- if(ikRadioButton1.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- PrintReport("GetFrmSalesListPrincipalSingleProductOfPSumProductOfP","Get","FrmSalesList");
- }
- }
- if(ikRadioButton3.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- PrintReport("GetFrmSalesListCustomerSingleProductSumProduct","Get","FrmSalesList");
- }
- }
- if(ikRadioButton5.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- PrintReport("GetFrmSalesListDateSingleProductOfDSumProductOfD","Get","FrmSalesList");
- }
- }
- ]]></Click>
- </Events>
- </IKButton>
- <IKButton name="btnExcel">
- <Events>
- <Click>
- <![CDATA[
- if(ikRadioButton1.Checked==false && ikRadioButton2.Checked==false && ikRadioButton3.Checked==false && ikRadioButton4.Checked==false && ikRadioButton5.Checked==false)
- {
- MessageBox("请选择格式!",@Title);
- return;
- }
- Empty();
- @Company=GetCurrentCompanyNo();
- @Name_Create = GetCurrentUser();
- @StartDate = DBNull();
- @EndDate = DBNull();
- @StartNo_SaleBill = DBNull();
- @EndNo_SaleBill = DBNull();
- @StartNo_Customer = DBNull();
- @EndNo_Customer = DBNull();
- @StartNo_Principal = DBNull();
- @EndNo_Principal = DBNull();
- @StartNo_Location = DBNull();
- @EndNo_Location = DBNull();
- @StartNo_Product = DBNull();
- @EndNo_Product = DBNull();
- @StartType_Product = DBNull();
- @EndType_Product = DBNull();
- @Rtn = 0;
- if(ikRtnCheck.Checked)
- {
- @Rtn = 1;
- }
- if(dtStart.Checked==true)
- @StartDate = dtStart.CValue;
- if(dtEnd.Checked==true)
- @EndDate = dtEnd.CValue;
- if(tbSaleBillNo1.CValue != "")
- {@StartNo_SaleBill = tbSaleBillNo1.CValue;
- }
- if(tbSaleBillNo2.CValue != "")
- {@EndNo_SaleBill = tbSaleBillNo2.CValue;
- }
- if(tbCustomerNo1.CValue != "")
- {@StartNo_Customer = tbCustomerNo1.CValue;
- }
- 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;
- }
- }
- if(cbLocation1.Text!="")
- {
- if(!cbLocation1.CheckSelectedItem())
- {
- MessageBox("请选择有效的仓库!",@Title);
- cbLocation1.Focus();
- return;
- }
- else
- {
- @StartNo_Location = cbLocation1.SelectedNo;
- }
- }
- if(cbLocation2.Text!="")
- {
- if(!cbLocation2.CheckSelectedItem())
- {
- MessageBox("请选择有效的仓库!",@Title);
- cbLocation2.Focus();
- return;
- }
- else
- {
- @EndNo_Location = cbLocation2.SelectedNo;
- }
- }
- if(tbProduct1.CValue != "")
- @StartNo_Product = tbProduct1.CValue;
- if(tbProduct2.CValue != "")
- @EndNo_Product = tbProduct2.CValue;
- if(cbType1.Text != "")
- @StartType_Product = cbType1.Text;
- if(cbType2.Text != "")
- @EndType_Product = cbType2.Text;
- if(ikRadioButton4.Checked)
- {
- Search("SearchFrmSalesListLocation",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesListLocation")==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("Excel","GetFrmSalesListLocation","Get","FrmSalesListLocation");
- }
- }
- if(ikRadioButton2.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("Excel","GetFrmSalesListProduct","Get","FrmSalesList");
- }
- }
- if(ikRadioButton1.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("Excel","GetFrmSalesListPrincipalSingleProductOfPSumProductOfP","Get","FrmSalesList");
- }
- }
- if(ikRadioButton3.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("Excel","GetFrmSalesListCustomerSingleProductSumProduct","Get","FrmSalesList");
- }
- }
- if(ikRadioButton5.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("Excel","GetFrmSalesListDateSingleProductOfDSumProductOfD","Get","FrmSalesList");
- }
- }
- ]]></Click>
- </Events>
- </IKButton>
- <IKButton name="btnWord">
- <Events>
- <Click>
- <![CDATA[
- if(ikRadioButton1.Checked==false && ikRadioButton2.Checked==false && ikRadioButton3.Checked==false && ikRadioButton4.Checked==false && ikRadioButton5.Checked==false)
- {
- MessageBox("请选择格式!",@Title);
- return;
- }
- Empty();
- @Company=GetCurrentCompanyNo();
- @Name_Create = GetCurrentUser();
- @StartDate = DBNull();
- @EndDate = DBNull();
- @StartNo_SaleBill = DBNull();
- @EndNo_SaleBill = DBNull();
- @StartNo_Customer = DBNull();
- @EndNo_Customer = DBNull();
- @StartNo_Principal = DBNull();
- @EndNo_Principal = DBNull();
- @StartNo_Location = DBNull();
- @EndNo_Location = DBNull();
- @StartNo_Product = DBNull();
- @EndNo_Product = DBNull();
- @StartType_Product = DBNull();
- @EndType_Product = DBNull();
- @Rtn = 0;
- if(ikRtnCheck.Checked)
- {
- @Rtn = 1;
- }
- if(dtStart.Checked==true)
- @StartDate = dtStart.CValue;
- if(dtEnd.Checked==true)
- @EndDate = dtEnd.CValue;
- if(tbSaleBillNo1.CValue != "")
- {@StartNo_SaleBill = tbSaleBillNo1.CValue;
- }
- if(tbSaleBillNo2.CValue != "")
- {@EndNo_SaleBill = tbSaleBillNo2.CValue;
- }
- if(tbCustomerNo1.CValue != "")
- {@StartNo_Customer = tbCustomerNo1.CValue;
- }
- 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;
- }
- }
- if(cbLocation1.Text!="")
- {
- if(!cbLocation1.CheckSelectedItem())
- {
- MessageBox("请选择有效的仓库!",@Title);
- cbLocation1.Focus();
- return;
- }
- else
- {
- @StartNo_Location = cbLocation1.SelectedNo;
- }
- }
- if(cbLocation2.Text!="")
- {
- if(!cbLocation2.CheckSelectedItem())
- {
- MessageBox("请选择有效的仓库!",@Title);
- cbLocation2.Focus();
- return;
- }
- else
- {
- @EndNo_Location = cbLocation2.SelectedNo;
- }
- }
- if(tbProduct1.CValue != "")
- @StartNo_Product = tbProduct1.CValue;
- if(tbProduct2.CValue != "")
- @EndNo_Product = tbProduct2.CValue;
- if(cbType1.Text != "")
- @StartType_Product = cbType1.Text;
- if(cbType2.Text != "")
- @EndType_Product = cbType2.Text;
- if(ikRadioButton4.Checked)
- {
- Search("SearchFrmSalesListLocation",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesListLocation")==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("Word","GetFrmSalesListLocation","Get","FrmSalesListLocation");
- }
- }
- if(ikRadioButton2.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("Word","GetFrmSalesListProduct","Get","FrmSalesList");
- }
- }
- if(ikRadioButton1.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("Word","GetFrmSalesListPrincipalSingleProductOfPSumProductOfP","Get","FrmSalesList");
- }
- }
- if(ikRadioButton3.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("Word","GetFrmSalesListCustomerSingleProductSumProduct","Get","FrmSalesList");
- }
- }
- if(ikRadioButton5.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("Word","GetFrmSalesListDateSingleProductOfDSumProductOfD","Get","FrmSalesList");
- }
- }
- ]]>
- </Click>
- </Events>
- </IKButton>
- <IKButton name="btnPrint">
- <Events>
- <Click>
- <![CDATA[
- if(ikRadioButton1.Checked==false && ikRadioButton2.Checked==false && ikRadioButton3.Checked==false && ikRadioButton4.Checked==false && ikRadioButton5.Checked==false)
- {
- MessageBox("请选择格式!",@Title);
- return;
- }
- Empty();
- @Company=GetCurrentCompanyNo();
- @Name_Create = GetCurrentUser();
- @StartDate = DBNull();
- @EndDate = DBNull();
- @StartNo_SaleBill = DBNull();
- @EndNo_SaleBill = DBNull();
- @StartNo_Customer = DBNull();
- @EndNo_Customer = DBNull();
- @StartNo_Principal = DBNull();
- @EndNo_Principal = DBNull();
- @StartNo_Location = DBNull();
- @EndNo_Location = DBNull();
- @StartNo_Product = DBNull();
- @EndNo_Product = DBNull();
- @StartType_Product = DBNull();
- @EndType_Product = DBNull();
- @Rtn = 0;
- if(ikRtnCheck.Checked)
- {
- @Rtn = 1;
- }
- if(dtStart.Checked==true)
- @StartDate = dtStart.CValue;
- if(dtEnd.Checked==true)
- @EndDate = dtEnd.CValue;
- if(tbSaleBillNo1.CValue != "")
- {@StartNo_SaleBill = tbSaleBillNo1.CValue;
- }
- if(tbSaleBillNo2.CValue != "")
- {@EndNo_SaleBill = tbSaleBillNo2.CValue;
- }
- if(tbCustomerNo1.CValue != "")
- {@StartNo_Customer = tbCustomerNo1.CValue;
- }
- 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;
- }
- }
- if(cbLocation1.Text!="")
- {
- if(!cbLocation1.CheckSelectedItem())
- {
- MessageBox("请选择有效的仓库!",@Title);
- cbLocation1.Focus();
- return;
- }
- else
- {
- @StartNo_Location = cbLocation1.SelectedNo;
- }
- }
- if(cbLocation2.Text!="")
- {
- if(!cbLocation2.CheckSelectedItem())
- {
- MessageBox("请选择有效的仓库!",@Title);
- cbLocation2.Focus();
- return;
- }
- else
- {
- @EndNo_Location = cbLocation2.SelectedNo;
- }
- }
- if(tbProduct1.CValue != "")
- @StartNo_Product = tbProduct1.CValue;
- if(tbProduct2.CValue != "")
- @EndNo_Product = tbProduct2.CValue;
- if(cbType1.Text != "")
- @StartType_Product = cbType1.Text;
- if(cbType2.Text != "")
- @EndType_Product = cbType2.Text;
- if(ikRadioButton4.Checked)
- {
- Search("SearchFrmSalesListLocation",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesListLocation")==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("PrintToPrinter","GetFrmSalesListLocation","Get","FrmSalesListLocation");
- }
- }
- if(ikRadioButton2.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("PrintToPrinter","GetFrmSalesListProduct","Get","FrmSalesList");
- }
- }
- if(ikRadioButton1.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("PrintToPrinter","GetFrmSalesListPrincipalSingleProductOfPSumProductOfP","Get","FrmSalesList");
- }
- }
- if(ikRadioButton3.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("PrintToPrinter","GetFrmSalesListCustomerSingleProductSumProduct","Get","FrmSalesList");
- }
- }
- if(ikRadioButton5.Checked)
- {
- Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
- @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
- @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
- if(RowCount("#FrmSalesList") ==0)
- {
- MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
- }
- else
- {
- ExportReport("PrintToPrinter","GetFrmSalesListDateSingleProductOfDSumProductOfD","Get","FrmSalesList");
- }
- }
- ]]></Click>
- </Events>
- </IKButton>
- </Controls>
- <ChildForms>
- <ChildForm name="BillSearch" DataSource="SaleBill" SearchFunction="SearchAllBill" SearchFunctionCondition="SearchBillCondition" SearchFunctionByNo="">
- <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="销售单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="2" MappingName="#SaleBill.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="3" MappingName="#SaleBill.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="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
- <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
- </ChildForm>
- </ChildForms>
- <FormatString>
- <Format name="SearchCustomerCondition">
- if(GetRight("客户基本资料","全权查看"))
- {
- FormatString("");
- }
- else
- {
- FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
- }
- </Format>
- <Format name="SearchBillCondition">
- if(GetRight("客户基本资料","全权查看"))
- {
- FormatString("");
- }
- else
- {
- FormatString(" Disable_SaleBill=0 and Customer.ID_Creator='{0}' ",GetLoginUserID());
- }
- </Format>
- </FormatString>
- </Client>
- <Server>
- <Tables>
- <Table name="SaleBill" Type="Parent">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 SaleBill.* FROM SaleBill"/>
- </Table>
- <Table name="Get" Type="Other">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 convert(datetime,0) as StartDate,
- convert(datetime,0) as EndDate ,
- convert(nvarchar(64),'') as StartNo_SaleBill ,
- convert(nvarchar(64),'') as EndNo_SaleBill ,
- convert(nvarchar(64),'') as StartNo_Customer ,
- convert(nvarchar(64),'') as EndNo_Customer ,
- convert(nvarchar(64),'') as StartNo_Principal ,
- convert(nvarchar(64),'') as EndNo_Principal ,
- convert(nvarchar(64),'') as StartNo_Location ,
- convert(nvarchar(64),'') as EndNo_Location ,
- convert(nvarchar(64),'') as StartNo_Product,
- convert(nvarchar(64),'') as EndNo_Product ,
- convert(nvarchar(64),'') as StartType_Product ,
- convert(nvarchar(64),'') as EndType_Product,
- convert(nvarchar(64),'') as Company ,
- convert(nvarchar(64),'') as Name_Create "/>
- </Table>
- <Table name="FrmSalesListLocation" Type="Other">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS Name_Location,
- CONVERT(NVARCHAR(64),'') AS No_Product,
- CONVERT(NVARCHAR(64),'') AS Name_Product,
- CONVERT(DATETIME,0) AS Date_SaleBill ,
- CONVERT(NVARCHAR(64),'') AS No_SaleBill,
- CONVERT(NVARCHAR(64),'') AS ShortName_Customer,
- CONVERT(NVARCHAR(64),'') AS Principal_SaleBill,
- CONVERT(NVARCHAR(64),'') AS Unit_Product,
- CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
- CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleBill,
- CONVERT(DECIMAL,0.00) AS Quantity,
- CONVERT(DECIMAL,0.00) AS MoneySum,
- CONVERT(DECIMAL,0.00) AS Amount,
- CONVERT(DECIMAL,0.00) AS CurrencyAmount,
- CONVERT(DECIMAL,0.00) AS Price_Product
- "/>
- </Table>
- <Table name="FrmSalesListProduct" Type="Other">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_Product, CONVERT(NVARCHAR(64),'') AS Name_Product,
- CONVERT(NVARCHAR(64),'') AS No_SaleBill,
- CONVERT(DATETIME,0) AS Date_SaleBill,
- CONVERT(NVARCHAR(64),'') AS ShortName_Customer,
- CONVERT(NVARCHAR(64),'') AS Principal_SaleBill,
- CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
- CONVERT(NVARCHAR(64),'') AS Name_Location,
- CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleBill,
- CONVERT(DECIMAL,0.00) AS Price_Product,
- CONVERT(NVARCHAR(64),'') AS Unit_Product,
- CONVERT(DECIMAL,0.00) AS Quantity,
- CONVERT(DECIMAL,0.00) AS MoneySum,
- CONVERT(DECIMAL,0.00) AS Amount,
- CONVERT(DECIMAL,0.00) AS CurrencyAmount
- "/>
- </Table>
- <Table name="FrmSalesList" Type="Other">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS Principal_SaleBill,
- CONVERT(NVARCHAR(64),'') AS ShortName_Customer,
- CONVERT(NVARCHAR(64),'') AS No_SaleBill,
- CONVERT(DATETIME,0) AS Date_SaleBill,
- CONVERT(NVARCHAR(64),'') AS Name_Location,
- CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleBill,
- CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
- CONVERT(DECIMAL,0.00) AS TaxAmount,
- CONVERT(DECIMAL,0.00) AS Quantity,
- CONVERT(DECIMAL,0.00) AS MoneySum,
- CONVERT(DECIMAL,0.00) AS Amount,
- CONVERT(DECIMAL,0.00) AS CurrencyAmount
- "/>
- </Table>
- <Table name="SingleProductOfP" Type="Other">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_SaleBill,
- CONVERT(NVARCHAR(64),'') AS No_Product,
- CONVERT(NVARCHAR(64),'') AS Name_Product,
- CONVERT(DECIMAL,0.00) AS Quantity_SaleBillProduct,
- CONVERT(DECIMAL,0.00) AS Price_Product,
- CONVERT(DECIMAL,0.00) AS ProductMoney
- "/>
- </Table>
- <Table name="SumProductOfP" Type="Other">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS Principal_SaleBill,
- CONVERT(NVARCHAR(64),'') AS No_Product,
- CONVERT(NVARCHAR(64),'') AS Name_Product,
- CONVERT(NVARCHAR(64),'') AS Unit_Product,
- CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
- CONVERT(DECIMAL,0.00) AS Quantity,
- CONVERT(DECIMAL,0.00) AS AVGPrice_Product,
- CONVERT(DECIMAL,0.00) AS NOTexMoney
- "/>
- </Table>
- <Table name="FrmSalesListCustomer" Type="Other">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_Customer,
- CONVERT(NVARCHAR(64),'') AS ShortName_Customer,
- CONVERT(NVARCHAR(64),'') AS No_SaleBill,
- CONVERT(DATETIME,0) AS Date_SaleBill,
- CONVERT(NVARCHAR(64),'') AS Principal_SaleBill,
- CONVERT(NVARCHAR(64),'') AS Name_Location,
- CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleBill,
- CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
- CONVERT(DECIMAL,0.00) AS TaxAmount,
- CONVERT(DECIMAL,0.00) AS Quantity,
- CONVERT(DECIMAL,0.00) AS MoneySum,
- CONVERT(DECIMAL,0.00) AS Amount,
- CONVERT(DECIMAL,0.00) AS CurrencyAmount
- "/>
- </Table>
- <Table name="SingleProduct" Type="Other">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_SaleBill,
- CONVERT(NVARCHAR(64),'') AS No_Product,
- CONVERT(NVARCHAR(64),'') AS Name_Product,
- CONVERT(DECIMAL,0.00) AS Quantity_SaleBillProduct,
- CONVERT(DECIMAL,0.00) AS Price_Product,
- CONVERT(DECIMAL,0.00) AS ProductMoney
- "/>
- </Table>
- <Table name="SumProduct" Type="Other">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_Product,
- CONVERT(NVARCHAR(64),'') AS Name_Product,
- CONVERT(NVARCHAR(64),'') AS Unit_Product,
- CONVERT(NVARCHAR(64),'') AS No_Customer,
- CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
- CONVERT(DECIMAL,0.00) AS Quantity,
- CONVERT(DECIMAL,0.00) AS AVGPrice_Product,
- CONVERT(DECIMAL,0.00) AS NOTexMoney
- "/>
- </Table>
- <Table name="FrmSalesListDate" Type="Other">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS Date_SaleBill,
- CONVERT(NVARCHAR(64),'') AS ShortName_Customer,
- CONVERT(NVARCHAR(64),'') AS No_SaleBill,
- CONVERT(NVARCHAR(64),'') AS Principal_SaleBill,
- CONVERT(NVARCHAR(64),'') AS Name_Location,
- CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleBill,
- CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
- CONVERT(DECIMAL,0.00) AS TaxAmount,
- CONVERT(DECIMAL,0.00) AS Quantity,
- CONVERT(DECIMAL,0.00) AS MoneySum,
- CONVERT(DECIMAL,0.00) AS Amount,
- CONVERT(DECIMAL,0.00) AS CurrencyAmount
- "/>
- </Table>
- <Table name="SingleProductOfD" Type="Other">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_SaleBill,
- CONVERT(NVARCHAR(64),'') AS No_Product,
- CONVERT(NVARCHAR(64),'') AS Name_Product,
- CONVERT(DECIMAL,0.00) AS Quantity_SaleBillProduct,
- CONVERT(DECIMAL,0.00) AS Price_Product,
- CONVERT(DECIMAL,0.00) AS ProductMoney
- "/>
- </Table>
- <Table name="SumProductOfD" Type="Other">
- <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS Date_SaleBill,
- CONVERT(NVARCHAR(64),'') AS No_Product,
- CONVERT(NVARCHAR(64),'') AS Name_Product,
- CONVERT(NVARCHAR(64),'') AS Unit_Product,
- CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
- CONVERT(DECIMAL,0.00) AS Quantity,
- CONVERT(DECIMAL,0.00) AS AVGPrice_Product,
- CONVERT(DECIMAL,0.00) AS NOTexMoney
- "/>
- </Table>
- </Tables>
- <Search>
- <SearchAllBill CmdType="Text" CmdText=" SELECT SaleBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
- Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer, Customer.ID_Creator,
- a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
- Location.No_Location, Location.Name_Location, CONVERT(decimal(18,6), 0) AS NumSum, CONVERT(decimal(18,6), 0) AS MoneySum,
- CONVERT(decimal(18,6), 0) AS TaxSum, Employee.No_Employee AS No_Principal, Employee.Name_Employee AS Principal_SaleBill
- FROM SaleBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
- LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
- LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
- LEFT JOIN AppUser c ON c.ID_User = SaleBill.LastModUser_SaleBill
- LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal">
- <Tables>
- <Table name="AllBill" />
- </Tables>
- </SearchAllBill>
- <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>
- <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product FROM Product ">
- <Tables>
- <Table name="AllProduct" />
- </Tables>
- </SearchAllProduct>
- <SearchPrincipal CmdType="Text" CmdText="SELECT DISTINCT No_Employee,Name_Employee
- FROM Employee
- ORDER BY No_Employee">
- <Tables>
- <Table name="Principal" />
- </Tables>
- </SearchPrincipal>
- <SearchLocation CmdType="Text" CmdText=" SELECT Location.No_Location, Location.Name_Location FROM Location WHERE Location.Level_Location = 0 ORDER BY Location.No_Location">
- <Tables>
- <Table name="Location" />
- </Tables>
- </SearchLocation>
- <SearchType CmdType="Text" CmdText=" SELECT Name_TypeDef as Type_Product FROM TypeDef WHERE (Type_TypeDef = 8) ORDER BY Name_TypeDef">
- <Tables>
- <Table name="Type"/>
- </Tables>
- </SearchType>
- <SearchFrmSalesListLocation CmdType="Text" CmdText=" declare @cessIn decimal(14,4)
- declare @sqlCmd nvarchar(4000)
- Select @cessIn=CessIn_SystemSetting From SystemSetting
- CREATE TABLE Get
- ( StartDate DATETIME,
- EndDate DATETIME,
- StartNo_SaleBill nvarchar(64),
- EndNo_SaleBill nvarchar(64),
- StartNo_Customer nvarchar(64),
- EndNo_Customer nvarchar(64),
- StartNo_Principal nvarchar(64),
- EndNo_Principal nvarchar(64),
- StartNo_Location nvarchar(64),
- EndNo_Location nvarchar(64),
- StartNo_Product nvarchar(64),
- EndNo_Product nvarchar(64),
- StartType_Product nvarchar(64),
- EndType_Product nvarchar(64),
- Company nvarchar(64),
- Name_Create nvarchar(64),
- )
- INSERT INTO Get(StartDate,EndDate,StartNo_SaleBill,EndNo_SaleBill,
- StartNo_Customer,EndNo_Customer,StartNo_Principal,EndNo_Principal,
- StartNo_Location,EndNo_Location,Company,Name_Create,
- StartNo_Product,EndNo_Product,StartType_Product,EndType_Product)
- VALUES (@StartDate,@EndDate,isnull(@StartNo_SaleBill,''),isnull(@EndNo_SaleBill,''),
- isnull(@StartNo_Customer,''),isnull(@EndNo_Customer,''),isnull(@StartNo_Principal,''),isnull(@EndNo_Principal,''),
- isnull(@StartNo_Location,''),isnull(@EndNo_Location,''),isnull(@Company,''),@Name_Create,
- isnull(@StartNo_Product,''),isnull(@EndNo_Product,''),isnull(@StartType_Product,''),isnull(@EndType_Product,''))
- SELECT * FROM Get
- DROP TABLE Get
-
- SELECT * FROM (
- select top 0 '' as sg,'' as Name_Location,'' as No_Product,'' as Name_Product,convert(datetime,'') as Date_SaleBill,'' as No_SaleBill,
- '' as ShortName_Customer,'' as Principal_SaleBill,Convert(decimal(14,2),0) as Quantity,'' as Unit_Product,
- Convert(decimal(14,2),0) as Price_Product,'' as Currency_SaleBill,'' as TaxCurrency_SaleBill,Convert(DECIMAL(14,2),0) AS MoneySum,convert(decimal(14,2),0) as Amount,
- convert(decimal(14,2),0) as CurrencyAmount,CONVERT(Decimal(14,2),0) as TaxAmount
- UNION ALL
- (
- SELECT sg=-1,Location.Name_Location,Product.No_Product,Product.Name_Product,SaleBill.Date_SaleBill,('销'+SaleBill.No_SaleBill) as No_SaleBill,
- Customer.ShortName_Customer,Employee.Name_Employee as Principal_SaleBill,convert(DECIMAL(14,2),SUM(SaleBillProduct.Quantity_SaleBillProduct)) AS Quantity,Product.Unit_Product,
- (UnitPrice_SaleBillProduct) AS Price_Product,
- SaleBill.Currency_SaleBill,SaleBill.TaxCurrency_SaleBill,
- MoneySum = case SaleBill.TaxCurrency_SaleBill
- When '内含' Then convert(DECIMAL(14,2),sum( (Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)/(1+@cessIn/100)))
- else convert(DECIMAL(14,2),SUM((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))) end,
- Amount=case SaleBill.TaxCurrency_SaleBill
- When '外加' Then convert(DECIMAL(14,2),sum((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(1+@cessIn/100)))
- else convert(DECIMAL(14,2),SUM((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))) end,
- CurrencyAmount=case SaleBill.TaxCurrency_SaleBill
- When '外加' Then convert(DECIMAL(14,2),SUM((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(1+@cessIn/100)))
- else convert(DECIMAL(14,2),SUM((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))) end,
- TaxAmount = case SaleBill.TaxCurrency_SaleBill
- When '外加' Then convert(DECIMAL(14,2),SUM((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(@cessIn/100)))
- When '内含' Then convert(DECIMAL(14,2),SUM((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*((@cessIn/100)/(1+@cessIn/100))))
- When '零税' Then 0
- When '免税' Then 0 end
- FROM SaleBill
- LEFT JOIN SaleBillProduct ON SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill
- LEFT JOIN Product ON Product.ID_Product = SaleBillProduct.ID_Product
- LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
- LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- WHERE SaleBill.ID_Assessor IS NOT NULL
- AND SaleBill.Date_SaleBill Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),SaleBill.Date_SaleBill) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),SaleBill.Date_SaleBill)
- AND SaleBill.No_SaleBill BETWEEN ISNULL(@StartNo_SaleBill,SaleBill.No_SaleBill) AND ISNULL(@EndNo_SaleBill,SaleBill.No_SaleBill)
- AND No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
- AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
- AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
- And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
- and Special_SaleBill=case @Special when 1 then Special_SaleBill else 0 End
- GROUP BY Product.No_Product,Product.Name_Product,SaleBill.No_SaleBill,SaleBill.Date_SaleBill,
- Customer.ShortName_Customer,Employee.Name_Employee,Location.Name_Location,
- SaleBill.Currency_SaleBill,SaleBill.TaxCurrency_SaleBill,(UnitPrice_SaleBillProduct),Product.Unit_Product
- )
- UNION ALL
- (
- SELECT sg=1,Location.Name_Location,Product.No_Product,Product.Name_Product,SaleRtnBill.Date_SaleRtnBill AS Date_SaleBill,('退'+SaleRtnBill.No_SaleRtnBill) as No_SaleBill,
- Customer.ShortName_Customer,Employee.Name_Employee as Principal_SaleBill,convert(DECIMAL(14,2),-SUM(SaleRtnBillProduct.Quantity_SaleRtnBillProduct)) AS Quantity,Product.Unit_Product,
- (UnitPrice_SaleRtnBillProduct) AS Price_Product,
- SaleRtnBill.Currency_SaleRtnBill as Currency_SaleBill,SaleRtnBill.TaxCurrency_SaleRtnBill as TaxCurrency_SaleBill,
- MoneySum = CASE @Rtn WHEN 1 THEN (case SaleRtnBill.TaxCurrency_SaleRtnBill
- When '内含' Then convert(DECIMAL(14,2),-sum( (Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)/(1+@cessIn/100)))
- else convert(DECIMAL(14,2),-SUM((Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))) end) ELSE 0 END,
- Amount=CASE @Rtn WHEN 1 THEN (case SaleRtnBill.TaxCurrency_SaleRtnBill
- When '外加' Then convert(DECIMAL(14,2),-sum((Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*(1+@cessIn/100)))
- else convert(DECIMAL(14,2),-SUM((Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))) end) ELSE 0 END,
- CurrencyAmount=CASE @Rtn WHEN 1 THEN (case SaleRtnBill.TaxCurrency_SaleRtnBill
- When '外加' Then convert(DECIMAL(14,2),-SUM((Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*(1+@cessIn/100)))
- else convert(DECIMAL(14,2),-SUM((Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))) end) ELSE 0 END,
- TaxAmount = CASE @Rtn WHEN 1 THEN (case SaleRtnBill.TaxCurrency_SaleRtnBill
- When '外加' Then convert(DECIMAL(14,2),-SUM((Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*(@cessIn/100)))
- When '内含' Then convert(DECIMAL(14,2),-SUM((Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*((@cessIn/100)/(1+@cessIn/100))))
- When '零税' Then 0
- When '免税' Then 0 end) ELSE 0 END
- FROM SaleRtnBill
- LEFT JOIN SaleRtnBillProduct ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- LEFT JOIN Product ON Product.ID_Product = SaleRtnBillProduct.ID_Product
- LEFT JOIN Location ON Location.ID_Location = SaleRtnBill.ID_Location
- LEFT JOIN Customer ON Customer.ID_Customer = SaleRtnBill.ID_Customer
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- WHERE SaleRtnBill.ID_Assessor IS NOT NULL
- AND SaleRtnBill.Date_SaleRtnBill Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),SaleRtnBill.Date_SaleRtnBill) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),SaleRtnBill.Date_SaleRtnBill)
- AND SaleRtnBill.No_SaleRtnBill BETWEEN ISNULL(@StartNo_SaleBill,SaleRtnBill.No_SaleRtnBill) AND ISNULL(@EndNo_SaleBill,SaleRtnBill.No_SaleRtnBill)
- AND No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
- AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
- AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
- And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
- GROUP BY Product.No_Product,Product.Name_Product,SaleRtnBill.No_SaleRtnBill,SaleRtnBill.Date_SaleRtnBill,
- Customer.ShortName_Customer,Employee.Name_Employee,Location.Name_Location,
- SaleRtnBill.Currency_SaleRtnBill,SaleRtnBill.TaxCurrency_SaleRtnBill,(UnitPrice_SaleRtnBillProduct),Product.Unit_Product
- )
- ) C
- WHERE MoneySum != 0 AND Amount != 0 AND CurrencyAmount != 0 --AND TaxAmount != 0
- ORDER BY C.Name_Location,No_Product,sg,Date_SaleBill
- ">
- <Params>
- <Param name="@StartDate" type="SaleBill.Date_SaleBill" Index="0" />
- <Param name="@EndDate" type="SaleBill.Date_SaleBill" Index="1" />
- <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
- <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
- <Param name="@StartNo_Customer" type="SaleBill.No_Customer" Index="4" />
- <Param name="@EndNo_Customer" type="SaleBill.No_Customer" Index="5" />
- <Param name="@StartNo_Principal" type="SaleBill.No_Customer" Index="6" />
- <Param name="@EndNo_Principal" type="SaleBill.No_Customer" Index="7" />
- <Param name="@StartNo_Location" type="SaleBill.No_Location" Index="8" />
- <Param name="@EndNo_Location" type="SaleBill.No_Location" Index="9" />
- <Param name="@StartNo_Product" type="SaleBill.No_Product" Index="10" />
- <Param name="@EndNo_Product" type="SaleBill.No_Product" Index="11" />
- <Param name="@StartType_Product" type="SaleBill.Type_Product" Index="12" />
- <Param name="@EndType_Product" type="SaleBill.Type_Product" Index="13" />
- <Param name="@Company" type="SaleBill.Type_Product" Index="14" />
- <Param name="@Name_Create" type="SaleBill.Name_Location" Index="15" />
- <Param name="@Right" type="SaleBill.ID_Customer" Index="16" />
- <Param name="@Rtn" type="Product.No_Product" Index="17" />
- <Param name="@Special" type="SaleBill.Special_SaleBill" Index="18" />
- </Params>
- <Tables>
- <Table name="Get" />
- <Table name="FrmSalesListLocation"/>
- </Tables>
- </SearchFrmSalesListLocation>
- <SearchFrmSalesList CmdType="Text" CmdText="declare @cessIn decimal(14,4)
- declare @sqlCmd nvarchar(4000)
- Select @cessIn=CessIn_SystemSetting From SystemSetting
- CREATE TABLE Get
- (
- StartDate DATETIME,
- EndDate DATETIME,
- StartNo_SaleBill nvarchar(64),
- EndNo_SaleBill nvarchar(64),
- StartNo_Customer nvarchar(64),
- EndNo_Customer nvarchar(64),
- StartNo_Principal nvarchar(64),
- EndNo_Principal nvarchar(64),
- StartNo_Location nvarchar(64),
- EndNo_Location nvarchar(64),
- StartNo_Product nvarchar(64),
- EndNo_Product nvarchar(64),
- StartType_Product nvarchar(64),
- EndType_Product nvarchar(64),
- Company nvarchar(64),
- Name_Create nvarchar(64)
- )
- INSERT INTO Get(StartDate,EndDate,StartNo_SaleBill,EndNo_SaleBill,
- StartNo_Customer,EndNo_Customer,StartNo_Principal,EndNo_Principal,
- StartNo_Location,EndNo_Location,Company,Name_Create,
- StartNo_Product,EndNo_Product,StartType_Product,EndType_Product)
- VALUES (@StartDate,@EndDate,isnull(@StartNo_SaleBill,''),isnull(@EndNo_SaleBill,''),
- isnull(@StartNo_Customer,''),isnull(@EndNo_Customer,''),isnull(@StartNo_Principal,''),isnull(@EndNo_Principal,''),
- isnull(@StartNo_Location,''),isnull(@EndNo_Location,''),isnull(@Company,''),@Name_Create,
- isnull(@StartNo_Product,''),isnull(@EndNo_Product,''),isnull(@StartType_Product,''),isnull(@EndType_Product,''))
- SELECT * FROM Get
- DROP TABLE Get
- select top 0 '' as BillType,'' as Principal_SaleBill,'' as ShortName_Customer,'' as No_SaleBill,convert(Datetime,'') as Date_SaleBill,'' as Name_Location,'' as Currency_SaleBill,
- '' as TaxCurrency_SaleBill,CONVERT(DECIMAL(14,2),0) AS MoneySum,CONVERT(DECIMAL(14,2),0) AS Amount,CONVERT(DECIMAL(14,2),0) AS CurrencyAmount,CONVERT(DECIMAL(14,2),0) AS TaxAmount,
- '' as No_Product,'' as Name_Product,CONVERT(DECIMAL(14,2),0) AS Quantity_SaleBillProduct,'' as Unit_Product,CONVERT(DECIMAL(14,2),0) AS Price_Product,CONVERT(DECIMAL(14,2),0) AS ProductMoney,'' as No_Customer
- union all
- (
- SELECT '销' as BillType,Employee.Name_Employee as Principal_SaleBill,Customer.ShortName_Customer,(SaleBill.No_SaleBill) as No_SaleBill,SaleBill.Date_SaleBill,
- Location.Name_Location,SaleBill.Currency_SaleBill,SaleBill.TaxCurrency_SaleBill,
- MoneySum = case SaleBill.TaxCurrency_SaleBill
- When '内含' Then convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)/(1+@cessIn/100))
- else convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)) end,
- Amount=case SaleBill.TaxCurrency_SaleBill
- When '外加' Then convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(1+@cessIn/100))
- else convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)) end,
- CurrencyAmount=case SaleBill.TaxCurrency_SaleBill
- When '外加' Then convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(1+@cessIn/100))
- else convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)) end,
- TaxAmount = case SaleBill.TaxCurrency_SaleBill
- When '外加' Then convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(@cessIn/100))
- When '内含' Then convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*((@cessIn/100)/(1+@cessIn/100)))
- When '零税' Then 0
- When '免税' Then 0 end,Product.No_Product,Product.Name_Product,SaleBillProduct.Quantity_SaleBillProduct,
- Product.Unit_Product,(UnitPrice_SaleBillProduct) AS Price_Product,
- (UnitPrice_SaleBillProduct*Quantity_SaleBillProduct) AS ProductMoney,No_Customer
- FROM SaleBill
- LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
- LEFT JOIN SaleBillProduct ON SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
- LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
- LEFT JOIN Product ON Product.ID_Product = SaleBillProduct.ID_Product
- WHERE SaleBill.ID_Assessor IS NOT NULL
- AND SaleBill.Date_SaleBill Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),SaleBill.Date_SaleBill) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),SaleBill.Date_SaleBill)
- AND SaleBill.No_SaleBill BETWEEN ISNULL(@StartNo_SaleBill,SaleBill.No_SaleBill) AND ISNULL(@EndNo_SaleBill,SaleBill.No_SaleBill)
- AND No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
- AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
- AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
- And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
- and Special_SaleBill=case @Special when 1 then Special_SaleBill else 0 End
- )
- union all
- (
- SELECT '退' as BiiType,Employee.Name_Employee as Principal_SaleBill,Customer.ShortName_Customer,(SaleRtnBill.No_SaleRtnBill) as No_SaleBill,(SaleRtnBill.Date_SaleRtnBill) as Date_SaleBill,
- Location.Name_Location,SaleRtnBill.Currency_SaleRtnBill,SaleRtnBill.TaxCurrency_SaleRtnBill,
- MoneySum = case SaleRtnBill.TaxCurrency_SaleRtnBill
- When '内含' Then convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)/(1+@cessIn/100))
- else convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)) end,
- Amount=case SaleRtnBill.TaxCurrency_SaleRtnBill
- When '外加' Then convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*(1+@cessIn/100))
- else convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)) end,
- CurrencyAmount=case SaleRtnBill.TaxCurrency_SaleRtnBill
- When '外加' Then convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*(1+@cessIn/100))
- else convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)) end,
- TaxAmount = case SaleRtnBill.TaxCurrency_SaleRtnBill
- When '外加' Then convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*(@cessIn/100))
- When '内含' Then convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*((@cessIn/100)/(1+@cessIn/100)))
- When '零税' Then 0
- When '免税' Then 0 end,Product.No_Product,Product.Name_Product,-SaleRtnBillProduct.Quantity_SaleRtnBillProduct as Quantity_SaleBillProduct,
- Product.Unit_Product,(UnitPrice_SaleRtnBillProduct) AS Price_Product,
- -(UnitPrice_SaleRtnBillProduct*Quantity_SaleRtnBillProduct) AS ProductMoney,No_Customer
- FROM SaleRtnBill
- LEFT JOIN Location ON Location.ID_Location = SaleRtnBill.ID_Location
- LEFT JOIN SaleRtnBillProduct ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
- LEFT JOIN Customer ON Customer.ID_Customer = SaleRtnBill.ID_Customer
- LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
- LEFT JOIN Product ON Product.ID_Product = SaleRtnBillProduct.ID_Product
- WHERE SaleRtnBill.ID_Assessor IS NOT NULL
- AND SaleRtnBill.Date_SaleRtnBill Between isnull(DateAdd(day,DateDiff(day,0,@StartDate),0),SaleRtnBill.Date_SaleRtnBill) AND Isnull(DateAdd(day,DateDiff(day,0,@EndDate),1),SaleRtnBill.Date_SaleRtnBill)
- AND SaleRtnBill.No_SaleRtnBill BETWEEN ISNULL(@StartNo_SaleBill,SaleRtnBill.No_SaleRtnBill) AND ISNULL(@EndNo_SaleBill,SaleRtnBill.No_SaleRtnBill)
- AND No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
- AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
- AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
- AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
- AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
- And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
- and @Rtn =1
- )
- order by BillType desc,Date_SaleBill">
- <Params>
- <Param name="@StartDate" type="SaleBill.Date_SaleBill" Index="0" />
- <Param name="@EndDate" type="SaleBill.Date_SaleBill" Index="1" />
- <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
- <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
- <Param name="@StartNo_Customer" type="SaleBill.No_Customer" Index="4" />
- <Param name="@EndNo_Customer" type="SaleBill.No_Customer" Index="5" />
- <Param name="@StartNo_Principal" type="SaleBill.No_Customer" Index="6" />
- <Param name="@EndNo_Principal" type="SaleBill.No_Customer" Index="7" />
- <Param name="@StartNo_Location" type="SaleBill.No_Location" Index="8" />
- <Param name="@EndNo_Location" type="SaleBill.No_Location" Index="9" />
- <Param name="@StartNo_Product" type="SaleBill.No_Product" Index="10" />
- <Param name="@EndNo_Product" type="SaleBill.No_Product" Index="11" />
- <Param name="@StartType_Product" type="SaleBill.Type_Product" Index="12" />
- <Param name="@EndType_Product" type="SaleBill.Type_Product" Index="13" />
- <Param name="@Company" type="SaleBill.Type_Product" Index="14" />
- <Param name="@Name_Create" type="SaleBill.Name_Location" Index="15" />
- <Param name="@Right" type="SaleBill.ID_Customer" Index="16" />
- <Param name="@Rtn" type="Product.No_Product" Index="17" />
- <Param name="@Special" type="SaleBill.Special_SaleBill" Index="18" />
- </Params>
- <Tables>
- <Table name="Get" />
- <Table name="FrmSalesList"/>
- </Tables>
- </SearchFrmSalesList>
-
- </Search>
- </Server>
- <Lables>
- <Search>
-
- </Search>
- </Lables>
- </Form>
- </Forms>
-
-
-
|