FrmSalesList.xml 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Forms>
  3. <Form Name="FrmSalesList">
  4. <Client>
  5. <Events>
  6. <Load><![CDATA[
  7. @Title="销货明细表";
  8. GetSchema();
  9. txtCoNo.CValue=GetCurrentCompanyNo();
  10. txtCoName.CValue=GetCurrentCompanyShortName();
  11. Empty();
  12. NewInstance();
  13. dtStart.CValue=GetCurrentTime();
  14. dtEnd.CValue=GetCurrentTime();
  15. ]]></Load>
  16. <Closing>
  17. ;
  18. </Closing>
  19. <Closed>
  20. ;
  21. </Closed>
  22. </Events>
  23. <Mode>
  24. <Search>
  25. <Lable name="Search"/>
  26. </Search>
  27. </Mode>
  28. <Controls>
  29. <IKDateTimePicker name = "dtStart">
  30. <Events>
  31. <CheckedChanged>
  32. dtEnd.Checked = dtStart.Checked;
  33. </CheckedChanged>
  34. <ValueChanged>
  35. dtEnd.CValue = dtStart.CValue;
  36. </ValueChanged>
  37. </Events>
  38. </IKDateTimePicker>
  39. <IKTextButton name="tbSaleBillNo1" >
  40. <Events>
  41. <Click>
  42. ShowSearchBox("BillSearch","HAVEDEPOT", "tbSaleBillNo1",tbSaleBillNo1.CValue);
  43. </Click>
  44. <TextBoxButtonTextChanged>
  45. tbSaleBillNo2.CValue = tbSaleBillNo1.CValue;
  46. </TextBoxButtonTextChanged>
  47. </Events>
  48. </IKTextButton>
  49. <IKTextButton name="tbSaleBillNo2" >
  50. <Events>
  51. <Click>
  52. ShowSearchBox("BillSearch","HAVEDEPOT", "tbSaleBillNo2",tbSaleBillNo2.CValue);
  53. </Click>
  54. </Events>
  55. </IKTextButton>
  56. <IKTextButton name="tbCustomerNo1" >
  57. <Events>
  58. <Click>
  59. <![CDATA[
  60. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo1.CValue);
  61. if( @temp == "" )
  62. return;
  63. tbCustomerNo1.CValue = @temp;
  64. ]]>
  65. </Click>
  66. <TextBoxButtonTextChanged>
  67. tbCustomerNo2.CValue = tbCustomerNo1.CValue;
  68. </TextBoxButtonTextChanged>
  69. </Events>
  70. </IKTextButton>
  71. <IKTextButton name="tbCustomerNo2" >
  72. <Events>
  73. <Click>
  74. <![CDATA[
  75. @temp = ShowSearchBox("CustomerSearch","INFOMATION",tbCustomerNo2.CValue);
  76. if( @temp == "" )
  77. return;
  78. tbCustomerNo2.CValue = @temp;
  79. ]]>
  80. </Click>
  81. </Events>
  82. </IKTextButton>
  83. <IKComboBoxEx name="cbPrincipal1" DataSource="Principal" DisplayMember="Name_Employee" NoMember="No_Employee">
  84. <Events>
  85. <Reload>
  86. UpdateForm(false, "cbPrincipal1");
  87. Search("SearchPrincipal");
  88. UpdateForm(true, "cbPrincipal1");
  89. </Reload>
  90. <TextChanged>
  91. cbPrincipal2.SelectedName = cbPrincipal1.SelectedName;
  92. cbPrincipal2.SelectedNo=cbPrincipal1.SelectedNo;
  93. </TextChanged>
  94. </Events>
  95. </IKComboBoxEx>
  96. <IKComboBoxEx name="cbPrincipal2" DataSource="Principal" DisplayMember="Name_Employee" NoMember="No_Employee">
  97. <Events>
  98. <Reload>
  99. UpdateForm(false, "cbPrincipal2");
  100. Search("SearchPrincipal");
  101. UpdateForm(true, "cbPrincipal2");
  102. </Reload>
  103. </Events>
  104. </IKComboBoxEx>
  105. <IKComboBoxEx name="cbLocation1" DataSource="Location" DisplayMember="Name_Location" NoMember="No_Location" >
  106. <Events>
  107. <Reload>
  108. UpdateForm(false, "cbLocation1");
  109. Search("SearchLocation");
  110. UpdateForm(true, "cbLocation1");
  111. </Reload>
  112. <TextChanged>
  113. cbLocation2.SelectedName = cbLocation1.SelectedName;
  114. cbLocation2.SelectedNo = cbLocation1.SelectedNo;
  115. </TextChanged>
  116. </Events>
  117. </IKComboBoxEx>
  118. <IKComboBoxEx name="cbLocation2" DataSource="Location" DisplayMember="Name_Location" NoMember="No_Location">
  119. <Events>
  120. <Reload>
  121. UpdateForm(false, "cbLocation2");
  122. Search("SearchLocation");
  123. UpdateForm(true, "cbLocation2");
  124. </Reload>
  125. </Events>
  126. </IKComboBoxEx>
  127. <IKTextButton name="tbProduct1" >
  128. <Events>
  129. <Click>
  130. <![CDATA[
  131. @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProduct1.CValue);
  132. if( @temp == "" )
  133. return;
  134. tbProduct1.CValue = @temp;
  135. ]]>
  136. </Click>
  137. <TextBoxButtonTextChanged>
  138. tbProduct2.CValue = tbProduct1.CValue;
  139. </TextBoxButtonTextChanged>
  140. </Events>
  141. </IKTextButton>
  142. <IKTextButton name="tbProduct2" >
  143. <Events>
  144. <Click>
  145. <![CDATA[
  146. @temp = ShowSearchBox("ProductSearch","INFOMATION",tbProduct2.CValue);
  147. if( @temp == "" )
  148. return;
  149. tbProduct2.CValue = @temp;
  150. ]]>
  151. </Click>
  152. </Events>
  153. </IKTextButton>
  154. <IKComboBoxEx name="cbType1" DataSource="Type" DisplayMember="Type_Product" >
  155. <Events>
  156. <Reload>
  157. UpdateForm(false, "cbType1");
  158. Search("SearchType");
  159. UpdateForm(true, "cbType1");
  160. </Reload>
  161. <TextChanged>
  162. cbType2.Text = cbType1.Text;
  163. </TextChanged>
  164. </Events>
  165. </IKComboBoxEx>
  166. <IKComboBoxEx name="cbType2" DataSource="Type" DisplayMember="Type_Product" >
  167. <Events>
  168. <Reload>
  169. UpdateForm(false, "cbType2");
  170. Search("SearchType");
  171. UpdateForm(true, "cbType2");
  172. </Reload>
  173. </Events>
  174. </IKComboBoxEx>
  175. <IKButton name="btnView">
  176. <Events>
  177. <Click>
  178. <![CDATA[
  179. if(ikRadioButton1.Checked==false && ikRadioButton2.Checked==false && ikRadioButton3.Checked==false && ikRadioButton4.Checked==false && ikRadioButton5.Checked==false)
  180. {
  181. MessageBox("请选择格式!",@Title);
  182. return;
  183. }
  184. Empty();
  185. @Company=GetCurrentCompanyNo();
  186. @Name_Create = GetCurrentUser();
  187. @StartDate = DBNull();
  188. @EndDate = DBNull();
  189. @StartNo_SaleBill = DBNull();
  190. @EndNo_SaleBill = DBNull();
  191. @StartNo_Customer = DBNull();
  192. @EndNo_Customer = DBNull();
  193. @StartNo_Principal = DBNull();
  194. @EndNo_Principal = DBNull();
  195. @StartNo_Location = DBNull();
  196. @EndNo_Location = DBNull();
  197. @StartNo_Product = DBNull();
  198. @EndNo_Product = DBNull();
  199. @StartType_Product = DBNull();
  200. @EndType_Product = DBNull();
  201. @Rtn = 0;
  202. if(ikRtnCheck.Checked)
  203. {
  204. @Rtn = 1;
  205. }
  206. if(dtStart.Checked==true)
  207. @StartDate = dtStart.CValue;
  208. if(dtEnd.Checked==true)
  209. @EndDate = dtEnd.CValue;
  210. if(tbSaleBillNo1.CValue != "")
  211. {@StartNo_SaleBill = tbSaleBillNo1.CValue;
  212. }
  213. if(tbSaleBillNo2.CValue != "")
  214. {@EndNo_SaleBill = tbSaleBillNo2.CValue;
  215. }
  216. if(tbCustomerNo1.CValue != "")
  217. {@StartNo_Customer = tbCustomerNo1.CValue;
  218. }
  219. if(tbCustomerNo2.CValue != "")
  220. {@EndNo_Customer = tbCustomerNo2.CValue;
  221. }
  222. if(cbPrincipal1.Text!="")
  223. {
  224. if(!cbPrincipal1.CheckSelectedItem())
  225. {
  226. MessageBox("请选择有效的业务负责人!",@Title);
  227. cbPrincipal1.Focus();
  228. return;
  229. }
  230. else
  231. {
  232. @StartNo_Principal = cbPrincipal1.SelectedNo;
  233. }
  234. }
  235. if(cbPrincipal2.Text!="")
  236. {
  237. if(!cbPrincipal2.CheckSelectedItem())
  238. {
  239. MessageBox("请选择有效的业务负责人!",@Title);
  240. cbPrincipal2.Focus();
  241. return;
  242. }
  243. else
  244. {
  245. @EndNo_Principal = cbPrincipal2.SelectedNo;
  246. }
  247. }
  248. if(cbLocation1.Text!="")
  249. {
  250. if(!cbLocation1.CheckSelectedItem())
  251. {
  252. MessageBox("请选择有效的仓库!",@Title);
  253. cbLocation1.Focus();
  254. return;
  255. }
  256. else
  257. {
  258. @StartNo_Location = cbLocation1.SelectedNo;
  259. }
  260. }
  261. if(cbLocation2.Text!="")
  262. {
  263. if(!cbLocation2.CheckSelectedItem())
  264. {
  265. MessageBox("请选择有效的仓库!",@Title);
  266. cbLocation2.Focus();
  267. return;
  268. }
  269. else
  270. {
  271. @EndNo_Location = cbLocation2.SelectedNo;
  272. }
  273. }
  274. if(tbProduct1.CValue != "")
  275. @StartNo_Product = tbProduct1.CValue;
  276. if(tbProduct2.CValue != "")
  277. @EndNo_Product = tbProduct2.CValue;
  278. if(cbType1.Text != "")
  279. @StartType_Product = cbType1.Text;
  280. if(cbType2.Text != "")
  281. @EndType_Product = cbType2.Text;
  282. if(ikRadioButton4.Checked)
  283. {
  284. Search("SearchFrmSalesListLocation",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
  285. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  286. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  287. if(RowCount("#FrmSalesListLocation")==0)
  288. {
  289. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  290. }
  291. else
  292. {
  293. PrintReport("GetFrmSalesListLocation","Get","FrmSalesListLocation");
  294. }
  295. }
  296. if(ikRadioButton2.Checked)
  297. {
  298. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
  299. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  300. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  301. if(RowCount("#FrmSalesList") ==0)
  302. {
  303. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  304. }
  305. else
  306. {
  307. PrintReport("GetFrmSalesListProduct","Get","FrmSalesList");
  308. }
  309. }
  310. if(ikRadioButton1.Checked)
  311. {
  312. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
  313. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  314. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  315. if(RowCount("#FrmSalesList") ==0)
  316. {
  317. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  318. }
  319. else
  320. {
  321. PrintReport("GetFrmSalesListPrincipalSingleProductOfPSumProductOfP","Get","FrmSalesList");
  322. }
  323. }
  324. if(ikRadioButton3.Checked)
  325. {
  326. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
  327. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  328. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  329. if(RowCount("#FrmSalesList") ==0)
  330. {
  331. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  332. }
  333. else
  334. {
  335. PrintReport("GetFrmSalesListCustomerSingleProductSumProduct","Get","FrmSalesList");
  336. }
  337. }
  338. if(ikRadioButton5.Checked)
  339. {
  340. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
  341. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  342. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  343. if(RowCount("#FrmSalesList") ==0)
  344. {
  345. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  346. }
  347. else
  348. {
  349. PrintReport("GetFrmSalesListDateSingleProductOfDSumProductOfD","Get","FrmSalesList");
  350. }
  351. }
  352. ]]></Click>
  353. </Events>
  354. </IKButton>
  355. <IKButton name="btnExcel">
  356. <Events>
  357. <Click>
  358. <![CDATA[
  359. if(ikRadioButton1.Checked==false && ikRadioButton2.Checked==false && ikRadioButton3.Checked==false && ikRadioButton4.Checked==false && ikRadioButton5.Checked==false)
  360. {
  361. MessageBox("请选择格式!",@Title);
  362. return;
  363. }
  364. Empty();
  365. @Company=GetCurrentCompanyNo();
  366. @Name_Create = GetCurrentUser();
  367. @StartDate = DBNull();
  368. @EndDate = DBNull();
  369. @StartNo_SaleBill = DBNull();
  370. @EndNo_SaleBill = DBNull();
  371. @StartNo_Customer = DBNull();
  372. @EndNo_Customer = DBNull();
  373. @StartNo_Principal = DBNull();
  374. @EndNo_Principal = DBNull();
  375. @StartNo_Location = DBNull();
  376. @EndNo_Location = DBNull();
  377. @StartNo_Product = DBNull();
  378. @EndNo_Product = DBNull();
  379. @StartType_Product = DBNull();
  380. @EndType_Product = DBNull();
  381. @Rtn = 0;
  382. if(ikRtnCheck.Checked)
  383. {
  384. @Rtn = 1;
  385. }
  386. if(dtStart.Checked==true)
  387. @StartDate = dtStart.CValue;
  388. if(dtEnd.Checked==true)
  389. @EndDate = dtEnd.CValue;
  390. if(tbSaleBillNo1.CValue != "")
  391. {@StartNo_SaleBill = tbSaleBillNo1.CValue;
  392. }
  393. if(tbSaleBillNo2.CValue != "")
  394. {@EndNo_SaleBill = tbSaleBillNo2.CValue;
  395. }
  396. if(tbCustomerNo1.CValue != "")
  397. {@StartNo_Customer = tbCustomerNo1.CValue;
  398. }
  399. if(tbCustomerNo2.CValue != "")
  400. {@EndNo_Customer = tbCustomerNo2.CValue;
  401. }
  402. if(cbPrincipal1.Text!="")
  403. {
  404. if(!cbPrincipal1.CheckSelectedItem())
  405. {
  406. MessageBox("请选择有效的业务负责人!",@Title);
  407. cbPrincipal1.Focus();
  408. return;
  409. }
  410. else
  411. {
  412. @StartNo_Principal = cbPrincipal1.SelectedNo;
  413. }
  414. }
  415. if(cbPrincipal2.Text!="")
  416. {
  417. if(!cbPrincipal2.CheckSelectedItem())
  418. {
  419. MessageBox("请选择有效的业务负责人!",@Title);
  420. cbPrincipal2.Focus();
  421. return;
  422. }
  423. else
  424. {
  425. @EndNo_Principal = cbPrincipal2.SelectedNo;
  426. }
  427. }
  428. if(cbLocation1.Text!="")
  429. {
  430. if(!cbLocation1.CheckSelectedItem())
  431. {
  432. MessageBox("请选择有效的仓库!",@Title);
  433. cbLocation1.Focus();
  434. return;
  435. }
  436. else
  437. {
  438. @StartNo_Location = cbLocation1.SelectedNo;
  439. }
  440. }
  441. if(cbLocation2.Text!="")
  442. {
  443. if(!cbLocation2.CheckSelectedItem())
  444. {
  445. MessageBox("请选择有效的仓库!",@Title);
  446. cbLocation2.Focus();
  447. return;
  448. }
  449. else
  450. {
  451. @EndNo_Location = cbLocation2.SelectedNo;
  452. }
  453. }
  454. if(tbProduct1.CValue != "")
  455. @StartNo_Product = tbProduct1.CValue;
  456. if(tbProduct2.CValue != "")
  457. @EndNo_Product = tbProduct2.CValue;
  458. if(cbType1.Text != "")
  459. @StartType_Product = cbType1.Text;
  460. if(cbType2.Text != "")
  461. @EndType_Product = cbType2.Text;
  462. if(ikRadioButton4.Checked)
  463. {
  464. Search("SearchFrmSalesListLocation",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
  465. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  466. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  467. if(RowCount("#FrmSalesListLocation")==0)
  468. {
  469. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  470. }
  471. else
  472. {
  473. ExportReport("Excel","GetFrmSalesListLocation","Get","FrmSalesListLocation");
  474. }
  475. }
  476. if(ikRadioButton2.Checked)
  477. {
  478. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
  479. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  480. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  481. if(RowCount("#FrmSalesList") ==0)
  482. {
  483. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  484. }
  485. else
  486. {
  487. ExportReport("Excel","GetFrmSalesListProduct","Get","FrmSalesList");
  488. }
  489. }
  490. if(ikRadioButton1.Checked)
  491. {
  492. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
  493. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  494. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  495. if(RowCount("#FrmSalesList") ==0)
  496. {
  497. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  498. }
  499. else
  500. {
  501. ExportReport("Excel","GetFrmSalesListPrincipalSingleProductOfPSumProductOfP","Get","FrmSalesList");
  502. }
  503. }
  504. if(ikRadioButton3.Checked)
  505. {
  506. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
  507. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  508. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  509. if(RowCount("#FrmSalesList") ==0)
  510. {
  511. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  512. }
  513. else
  514. {
  515. ExportReport("Excel","GetFrmSalesListCustomerSingleProductSumProduct","Get","FrmSalesList");
  516. }
  517. }
  518. if(ikRadioButton5.Checked)
  519. {
  520. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
  521. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  522. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  523. if(RowCount("#FrmSalesList") ==0)
  524. {
  525. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  526. }
  527. else
  528. {
  529. ExportReport("Excel","GetFrmSalesListDateSingleProductOfDSumProductOfD","Get","FrmSalesList");
  530. }
  531. }
  532. ]]></Click>
  533. </Events>
  534. </IKButton>
  535. <IKButton name="btnWord">
  536. <Events>
  537. <Click>
  538. <![CDATA[
  539. if(ikRadioButton1.Checked==false && ikRadioButton2.Checked==false && ikRadioButton3.Checked==false && ikRadioButton4.Checked==false && ikRadioButton5.Checked==false)
  540. {
  541. MessageBox("请选择格式!",@Title);
  542. return;
  543. }
  544. Empty();
  545. @Company=GetCurrentCompanyNo();
  546. @Name_Create = GetCurrentUser();
  547. @StartDate = DBNull();
  548. @EndDate = DBNull();
  549. @StartNo_SaleBill = DBNull();
  550. @EndNo_SaleBill = DBNull();
  551. @StartNo_Customer = DBNull();
  552. @EndNo_Customer = DBNull();
  553. @StartNo_Principal = DBNull();
  554. @EndNo_Principal = DBNull();
  555. @StartNo_Location = DBNull();
  556. @EndNo_Location = DBNull();
  557. @StartNo_Product = DBNull();
  558. @EndNo_Product = DBNull();
  559. @StartType_Product = DBNull();
  560. @EndType_Product = DBNull();
  561. @Rtn = 0;
  562. if(ikRtnCheck.Checked)
  563. {
  564. @Rtn = 1;
  565. }
  566. if(dtStart.Checked==true)
  567. @StartDate = dtStart.CValue;
  568. if(dtEnd.Checked==true)
  569. @EndDate = dtEnd.CValue;
  570. if(tbSaleBillNo1.CValue != "")
  571. {@StartNo_SaleBill = tbSaleBillNo1.CValue;
  572. }
  573. if(tbSaleBillNo2.CValue != "")
  574. {@EndNo_SaleBill = tbSaleBillNo2.CValue;
  575. }
  576. if(tbCustomerNo1.CValue != "")
  577. {@StartNo_Customer = tbCustomerNo1.CValue;
  578. }
  579. if(tbCustomerNo2.CValue != "")
  580. {@EndNo_Customer = tbCustomerNo2.CValue;
  581. }
  582. if(cbPrincipal1.Text!="")
  583. {
  584. if(!cbPrincipal1.CheckSelectedItem())
  585. {
  586. MessageBox("请选择有效的业务负责人!",@Title);
  587. cbPrincipal1.Focus();
  588. return;
  589. }
  590. else
  591. {
  592. @StartNo_Principal = cbPrincipal1.SelectedNo;
  593. }
  594. }
  595. if(cbPrincipal2.Text!="")
  596. {
  597. if(!cbPrincipal2.CheckSelectedItem())
  598. {
  599. MessageBox("请选择有效的业务负责人!",@Title);
  600. cbPrincipal2.Focus();
  601. return;
  602. }
  603. else
  604. {
  605. @EndNo_Principal = cbPrincipal2.SelectedNo;
  606. }
  607. }
  608. if(cbLocation1.Text!="")
  609. {
  610. if(!cbLocation1.CheckSelectedItem())
  611. {
  612. MessageBox("请选择有效的仓库!",@Title);
  613. cbLocation1.Focus();
  614. return;
  615. }
  616. else
  617. {
  618. @StartNo_Location = cbLocation1.SelectedNo;
  619. }
  620. }
  621. if(cbLocation2.Text!="")
  622. {
  623. if(!cbLocation2.CheckSelectedItem())
  624. {
  625. MessageBox("请选择有效的仓库!",@Title);
  626. cbLocation2.Focus();
  627. return;
  628. }
  629. else
  630. {
  631. @EndNo_Location = cbLocation2.SelectedNo;
  632. }
  633. }
  634. if(tbProduct1.CValue != "")
  635. @StartNo_Product = tbProduct1.CValue;
  636. if(tbProduct2.CValue != "")
  637. @EndNo_Product = tbProduct2.CValue;
  638. if(cbType1.Text != "")
  639. @StartType_Product = cbType1.Text;
  640. if(cbType2.Text != "")
  641. @EndType_Product = cbType2.Text;
  642. if(ikRadioButton4.Checked)
  643. {
  644. Search("SearchFrmSalesListLocation",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
  645. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  646. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  647. if(RowCount("#FrmSalesListLocation")==0)
  648. {
  649. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  650. }
  651. else
  652. {
  653. ExportReport("Word","GetFrmSalesListLocation","Get","FrmSalesListLocation");
  654. }
  655. }
  656. if(ikRadioButton2.Checked)
  657. {
  658. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
  659. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  660. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  661. if(RowCount("#FrmSalesList") ==0)
  662. {
  663. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  664. }
  665. else
  666. {
  667. ExportReport("Word","GetFrmSalesListProduct","Get","FrmSalesList");
  668. }
  669. }
  670. if(ikRadioButton1.Checked)
  671. {
  672. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
  673. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  674. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  675. if(RowCount("#FrmSalesList") ==0)
  676. {
  677. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  678. }
  679. else
  680. {
  681. ExportReport("Word","GetFrmSalesListPrincipalSingleProductOfPSumProductOfP","Get","FrmSalesList");
  682. }
  683. }
  684. if(ikRadioButton3.Checked)
  685. {
  686. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
  687. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  688. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  689. if(RowCount("#FrmSalesList") ==0)
  690. {
  691. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  692. }
  693. else
  694. {
  695. ExportReport("Word","GetFrmSalesListCustomerSingleProductSumProduct","Get","FrmSalesList");
  696. }
  697. }
  698. if(ikRadioButton5.Checked)
  699. {
  700. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
  701. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  702. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  703. if(RowCount("#FrmSalesList") ==0)
  704. {
  705. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  706. }
  707. else
  708. {
  709. ExportReport("Word","GetFrmSalesListDateSingleProductOfDSumProductOfD","Get","FrmSalesList");
  710. }
  711. }
  712. ]]>
  713. </Click>
  714. </Events>
  715. </IKButton>
  716. <IKButton name="btnPrint">
  717. <Events>
  718. <Click>
  719. <![CDATA[
  720. if(ikRadioButton1.Checked==false && ikRadioButton2.Checked==false && ikRadioButton3.Checked==false && ikRadioButton4.Checked==false && ikRadioButton5.Checked==false)
  721. {
  722. MessageBox("请选择格式!",@Title);
  723. return;
  724. }
  725. Empty();
  726. @Company=GetCurrentCompanyNo();
  727. @Name_Create = GetCurrentUser();
  728. @StartDate = DBNull();
  729. @EndDate = DBNull();
  730. @StartNo_SaleBill = DBNull();
  731. @EndNo_SaleBill = DBNull();
  732. @StartNo_Customer = DBNull();
  733. @EndNo_Customer = DBNull();
  734. @StartNo_Principal = DBNull();
  735. @EndNo_Principal = DBNull();
  736. @StartNo_Location = DBNull();
  737. @EndNo_Location = DBNull();
  738. @StartNo_Product = DBNull();
  739. @EndNo_Product = DBNull();
  740. @StartType_Product = DBNull();
  741. @EndType_Product = DBNull();
  742. @Rtn = 0;
  743. if(ikRtnCheck.Checked)
  744. {
  745. @Rtn = 1;
  746. }
  747. if(dtStart.Checked==true)
  748. @StartDate = dtStart.CValue;
  749. if(dtEnd.Checked==true)
  750. @EndDate = dtEnd.CValue;
  751. if(tbSaleBillNo1.CValue != "")
  752. {@StartNo_SaleBill = tbSaleBillNo1.CValue;
  753. }
  754. if(tbSaleBillNo2.CValue != "")
  755. {@EndNo_SaleBill = tbSaleBillNo2.CValue;
  756. }
  757. if(tbCustomerNo1.CValue != "")
  758. {@StartNo_Customer = tbCustomerNo1.CValue;
  759. }
  760. if(tbCustomerNo2.CValue != "")
  761. {@EndNo_Customer = tbCustomerNo2.CValue;
  762. }
  763. if(cbPrincipal1.Text!="")
  764. {
  765. if(!cbPrincipal1.CheckSelectedItem())
  766. {
  767. MessageBox("请选择有效的业务负责人!",@Title);
  768. cbPrincipal1.Focus();
  769. return;
  770. }
  771. else
  772. {
  773. @StartNo_Principal = cbPrincipal1.SelectedNo;
  774. }
  775. }
  776. if(cbPrincipal2.Text!="")
  777. {
  778. if(!cbPrincipal2.CheckSelectedItem())
  779. {
  780. MessageBox("请选择有效的业务负责人!",@Title);
  781. cbPrincipal2.Focus();
  782. return;
  783. }
  784. else
  785. {
  786. @EndNo_Principal = cbPrincipal2.SelectedNo;
  787. }
  788. }
  789. if(cbLocation1.Text!="")
  790. {
  791. if(!cbLocation1.CheckSelectedItem())
  792. {
  793. MessageBox("请选择有效的仓库!",@Title);
  794. cbLocation1.Focus();
  795. return;
  796. }
  797. else
  798. {
  799. @StartNo_Location = cbLocation1.SelectedNo;
  800. }
  801. }
  802. if(cbLocation2.Text!="")
  803. {
  804. if(!cbLocation2.CheckSelectedItem())
  805. {
  806. MessageBox("请选择有效的仓库!",@Title);
  807. cbLocation2.Focus();
  808. return;
  809. }
  810. else
  811. {
  812. @EndNo_Location = cbLocation2.SelectedNo;
  813. }
  814. }
  815. if(tbProduct1.CValue != "")
  816. @StartNo_Product = tbProduct1.CValue;
  817. if(tbProduct2.CValue != "")
  818. @EndNo_Product = tbProduct2.CValue;
  819. if(cbType1.Text != "")
  820. @StartType_Product = cbType1.Text;
  821. if(cbType2.Text != "")
  822. @EndType_Product = cbType2.Text;
  823. if(ikRadioButton4.Checked)
  824. {
  825. Search("SearchFrmSalesListLocation",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
  826. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  827. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  828. if(RowCount("#FrmSalesListLocation")==0)
  829. {
  830. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  831. }
  832. else
  833. {
  834. ExportReport("PrintToPrinter","GetFrmSalesListLocation","Get","FrmSalesListLocation");
  835. }
  836. }
  837. if(ikRadioButton2.Checked)
  838. {
  839. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill,@EndNo_SaleBill,@StartNo_Customer,
  840. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  841. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  842. if(RowCount("#FrmSalesList") ==0)
  843. {
  844. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  845. }
  846. else
  847. {
  848. ExportReport("PrintToPrinter","GetFrmSalesListProduct","Get","FrmSalesList");
  849. }
  850. }
  851. if(ikRadioButton1.Checked)
  852. {
  853. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
  854. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  855. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  856. if(RowCount("#FrmSalesList") ==0)
  857. {
  858. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  859. }
  860. else
  861. {
  862. ExportReport("PrintToPrinter","GetFrmSalesListPrincipalSingleProductOfPSumProductOfP","Get","FrmSalesList");
  863. }
  864. }
  865. if(ikRadioButton3.Checked)
  866. {
  867. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
  868. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  869. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  870. if(RowCount("#FrmSalesList") ==0)
  871. {
  872. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  873. }
  874. else
  875. {
  876. ExportReport("PrintToPrinter","GetFrmSalesListCustomerSingleProductSumProduct","Get","FrmSalesList");
  877. }
  878. }
  879. if(ikRadioButton5.Checked)
  880. {
  881. Search("SearchFrmSalesList",@StartDate,@EndDate,@StartNo_SaleBill, @EndNo_SaleBill,@StartNo_Customer,
  882. @EndNo_Customer,@StartNo_Principal,@EndNo_Principal,@StartNo_Location,@EndNo_Location,
  883. @StartNo_Product,@EndNo_Product,@StartType_Product,@EndType_Product,@Company,@Name_Create,GetRight("客户基本资料","全权查看")?DBNull():GetLoginUserID(),@Rtn,GetFieldRight("销货单","特价单","查看"));
  884. if(RowCount("#FrmSalesList") ==0)
  885. {
  886. MessageBox("没有查找到与此相匹配的纪录,未产生报表!",@Title);
  887. }
  888. else
  889. {
  890. ExportReport("PrintToPrinter","GetFrmSalesListDateSingleProductOfDSumProductOfD","Get","FrmSalesList");
  891. }
  892. }
  893. ]]></Click>
  894. </Events>
  895. </IKButton>
  896. </Controls>
  897. <ChildForms>
  898. <ChildForm name="BillSearch" DataSource="SaleBill" SearchFunction="SearchAllBill" SearchFunctionCondition="SearchBillCondition" SearchFunctionByNo="">
  899. <DataColumn Index="0" MappingName="#SaleBill.No_SaleBill" HeaderText="销售单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  900. <DataColumn Index="1" MappingName="#SaleBill.Date_SaleBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  901. <DataColumn Index="2" MappingName="#SaleBill.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  902. <DataColumn Index="3" MappingName="#SaleBill.ShortName_Customer" HeaderText="客户名称" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  903. </ChildForm>
  904. <ChildForm name="CustomerSearch" DataSource="Customer" SearchFunction="SearchAllCustomer" SearchFunctionCondition="SearchCustomerCondition" SearchFunctionByNo="" MappingName="客户">
  905. <DataColumn Index="0" MappingName="#Customer.No_Customer" HeaderText="客户编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  906. <DataColumn Index="1" MappingName="#Customer.ShortName_Customer" HeaderText="客户简称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  907. <DataColumn Index="2" MappingName="#Customer.Type_Customer" HeaderText="客户类型" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  908. <DataColumn Index="3" MappingName="#Customer.Level_Customer" HeaderText="客户等级" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  909. <DataColumn Index="4" MappingName="#Customer.IsGeneric_Customer" HeaderText="一般客户" Width="75" ColumnType="IKDataGridBoolColumn"/>
  910. </ChildForm>
  911. <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品">
  912. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  913. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  914. </ChildForm>
  915. </ChildForms>
  916. <FormatString>
  917. <Format name="SearchCustomerCondition">
  918. if(GetRight("客户基本资料","全权查看"))
  919. {
  920. FormatString("");
  921. }
  922. else
  923. {
  924. FormatString(" Customer.ID_Creator='{0}' ",GetLoginUserID());
  925. }
  926. </Format>
  927. <Format name="SearchBillCondition">
  928. if(GetRight("客户基本资料","全权查看"))
  929. {
  930. FormatString("");
  931. }
  932. else
  933. {
  934. FormatString(" Disable_SaleBill=0 and Customer.ID_Creator='{0}' ",GetLoginUserID());
  935. }
  936. </Format>
  937. </FormatString>
  938. </Client>
  939. <Server>
  940. <Tables>
  941. <Table name="SaleBill" Type="Parent">
  942. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 SaleBill.* FROM SaleBill"/>
  943. </Table>
  944. <Table name="Get" Type="Other">
  945. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 convert(datetime,0) as StartDate,
  946. convert(datetime,0) as EndDate ,
  947. convert(nvarchar(64),'') as StartNo_SaleBill ,
  948. convert(nvarchar(64),'') as EndNo_SaleBill ,
  949. convert(nvarchar(64),'') as StartNo_Customer ,
  950. convert(nvarchar(64),'') as EndNo_Customer ,
  951. convert(nvarchar(64),'') as StartNo_Principal ,
  952. convert(nvarchar(64),'') as EndNo_Principal ,
  953. convert(nvarchar(64),'') as StartNo_Location ,
  954. convert(nvarchar(64),'') as EndNo_Location ,
  955. convert(nvarchar(64),'') as StartNo_Product,
  956. convert(nvarchar(64),'') as EndNo_Product ,
  957. convert(nvarchar(64),'') as StartType_Product ,
  958. convert(nvarchar(64),'') as EndType_Product,
  959. convert(nvarchar(64),'') as Company ,
  960. convert(nvarchar(64),'') as Name_Create "/>
  961. </Table>
  962. <Table name="FrmSalesListLocation" Type="Other">
  963. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS Name_Location,
  964. CONVERT(NVARCHAR(64),'') AS No_Product,
  965. CONVERT(NVARCHAR(64),'') AS Name_Product,
  966. CONVERT(DATETIME,0) AS Date_SaleBill ,
  967. CONVERT(NVARCHAR(64),'') AS No_SaleBill,
  968. CONVERT(NVARCHAR(64),'') AS ShortName_Customer,
  969. CONVERT(NVARCHAR(64),'') AS Principal_SaleBill,
  970. CONVERT(NVARCHAR(64),'') AS Unit_Product,
  971. CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
  972. CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleBill,
  973. CONVERT(DECIMAL,0.00) AS Quantity,
  974. CONVERT(DECIMAL,0.00) AS MoneySum,
  975. CONVERT(DECIMAL,0.00) AS Amount,
  976. CONVERT(DECIMAL,0.00) AS CurrencyAmount,
  977. CONVERT(DECIMAL,0.00) AS Price_Product
  978. "/>
  979. </Table>
  980. <Table name="FrmSalesListProduct" Type="Other">
  981. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_Product, CONVERT(NVARCHAR(64),'') AS Name_Product,
  982. CONVERT(NVARCHAR(64),'') AS No_SaleBill,
  983. CONVERT(DATETIME,0) AS Date_SaleBill,
  984. CONVERT(NVARCHAR(64),'') AS ShortName_Customer,
  985. CONVERT(NVARCHAR(64),'') AS Principal_SaleBill,
  986. CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
  987. CONVERT(NVARCHAR(64),'') AS Name_Location,
  988. CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleBill,
  989. CONVERT(DECIMAL,0.00) AS Price_Product,
  990. CONVERT(NVARCHAR(64),'') AS Unit_Product,
  991. CONVERT(DECIMAL,0.00) AS Quantity,
  992. CONVERT(DECIMAL,0.00) AS MoneySum,
  993. CONVERT(DECIMAL,0.00) AS Amount,
  994. CONVERT(DECIMAL,0.00) AS CurrencyAmount
  995. "/>
  996. </Table>
  997. <Table name="FrmSalesList" Type="Other">
  998. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS Principal_SaleBill,
  999. CONVERT(NVARCHAR(64),'') AS ShortName_Customer,
  1000. CONVERT(NVARCHAR(64),'') AS No_SaleBill,
  1001. CONVERT(DATETIME,0) AS Date_SaleBill,
  1002. CONVERT(NVARCHAR(64),'') AS Name_Location,
  1003. CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleBill,
  1004. CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
  1005. CONVERT(DECIMAL,0.00) AS TaxAmount,
  1006. CONVERT(DECIMAL,0.00) AS Quantity,
  1007. CONVERT(DECIMAL,0.00) AS MoneySum,
  1008. CONVERT(DECIMAL,0.00) AS Amount,
  1009. CONVERT(DECIMAL,0.00) AS CurrencyAmount
  1010. "/>
  1011. </Table>
  1012. <Table name="SingleProductOfP" Type="Other">
  1013. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_SaleBill,
  1014. CONVERT(NVARCHAR(64),'') AS No_Product,
  1015. CONVERT(NVARCHAR(64),'') AS Name_Product,
  1016. CONVERT(DECIMAL,0.00) AS Quantity_SaleBillProduct,
  1017. CONVERT(DECIMAL,0.00) AS Price_Product,
  1018. CONVERT(DECIMAL,0.00) AS ProductMoney
  1019. "/>
  1020. </Table>
  1021. <Table name="SumProductOfP" Type="Other">
  1022. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS Principal_SaleBill,
  1023. CONVERT(NVARCHAR(64),'') AS No_Product,
  1024. CONVERT(NVARCHAR(64),'') AS Name_Product,
  1025. CONVERT(NVARCHAR(64),'') AS Unit_Product,
  1026. CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
  1027. CONVERT(DECIMAL,0.00) AS Quantity,
  1028. CONVERT(DECIMAL,0.00) AS AVGPrice_Product,
  1029. CONVERT(DECIMAL,0.00) AS NOTexMoney
  1030. "/>
  1031. </Table>
  1032. <Table name="FrmSalesListCustomer" Type="Other">
  1033. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_Customer,
  1034. CONVERT(NVARCHAR(64),'') AS ShortName_Customer,
  1035. CONVERT(NVARCHAR(64),'') AS No_SaleBill,
  1036. CONVERT(DATETIME,0) AS Date_SaleBill,
  1037. CONVERT(NVARCHAR(64),'') AS Principal_SaleBill,
  1038. CONVERT(NVARCHAR(64),'') AS Name_Location,
  1039. CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleBill,
  1040. CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
  1041. CONVERT(DECIMAL,0.00) AS TaxAmount,
  1042. CONVERT(DECIMAL,0.00) AS Quantity,
  1043. CONVERT(DECIMAL,0.00) AS MoneySum,
  1044. CONVERT(DECIMAL,0.00) AS Amount,
  1045. CONVERT(DECIMAL,0.00) AS CurrencyAmount
  1046. "/>
  1047. </Table>
  1048. <Table name="SingleProduct" Type="Other">
  1049. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_SaleBill,
  1050. CONVERT(NVARCHAR(64),'') AS No_Product,
  1051. CONVERT(NVARCHAR(64),'') AS Name_Product,
  1052. CONVERT(DECIMAL,0.00) AS Quantity_SaleBillProduct,
  1053. CONVERT(DECIMAL,0.00) AS Price_Product,
  1054. CONVERT(DECIMAL,0.00) AS ProductMoney
  1055. "/>
  1056. </Table>
  1057. <Table name="SumProduct" Type="Other">
  1058. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_Product,
  1059. CONVERT(NVARCHAR(64),'') AS Name_Product,
  1060. CONVERT(NVARCHAR(64),'') AS Unit_Product,
  1061. CONVERT(NVARCHAR(64),'') AS No_Customer,
  1062. CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
  1063. CONVERT(DECIMAL,0.00) AS Quantity,
  1064. CONVERT(DECIMAL,0.00) AS AVGPrice_Product,
  1065. CONVERT(DECIMAL,0.00) AS NOTexMoney
  1066. "/>
  1067. </Table>
  1068. <Table name="FrmSalesListDate" Type="Other">
  1069. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS Date_SaleBill,
  1070. CONVERT(NVARCHAR(64),'') AS ShortName_Customer,
  1071. CONVERT(NVARCHAR(64),'') AS No_SaleBill,
  1072. CONVERT(NVARCHAR(64),'') AS Principal_SaleBill,
  1073. CONVERT(NVARCHAR(64),'') AS Name_Location,
  1074. CONVERT(NVARCHAR(64),'') AS TaxCurrency_SaleBill,
  1075. CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
  1076. CONVERT(DECIMAL,0.00) AS TaxAmount,
  1077. CONVERT(DECIMAL,0.00) AS Quantity,
  1078. CONVERT(DECIMAL,0.00) AS MoneySum,
  1079. CONVERT(DECIMAL,0.00) AS Amount,
  1080. CONVERT(DECIMAL,0.00) AS CurrencyAmount
  1081. "/>
  1082. </Table>
  1083. <Table name="SingleProductOfD" Type="Other">
  1084. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS No_SaleBill,
  1085. CONVERT(NVARCHAR(64),'') AS No_Product,
  1086. CONVERT(NVARCHAR(64),'') AS Name_Product,
  1087. CONVERT(DECIMAL,0.00) AS Quantity_SaleBillProduct,
  1088. CONVERT(DECIMAL,0.00) AS Price_Product,
  1089. CONVERT(DECIMAL,0.00) AS ProductMoney
  1090. "/>
  1091. </Table>
  1092. <Table name="SumProductOfD" Type="Other">
  1093. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 CONVERT(NVARCHAR(64),'') AS Date_SaleBill,
  1094. CONVERT(NVARCHAR(64),'') AS No_Product,
  1095. CONVERT(NVARCHAR(64),'') AS Name_Product,
  1096. CONVERT(NVARCHAR(64),'') AS Unit_Product,
  1097. CONVERT(NVARCHAR(64),'') AS Currency_SaleBill,
  1098. CONVERT(DECIMAL,0.00) AS Quantity,
  1099. CONVERT(DECIMAL,0.00) AS AVGPrice_Product,
  1100. CONVERT(DECIMAL,0.00) AS NOTexMoney
  1101. "/>
  1102. </Table>
  1103. </Tables>
  1104. <Search>
  1105. <SearchAllBill CmdType="Text" CmdText=" SELECT SaleBill.*, Customer.No_Customer, Customer.Name_Customer, Customer.ShortName_Customer,
  1106. Customer.Type_Customer, Customer.LastDiscount_Customer, Customer.PostalCode_Customer, Customer.ID_Creator,
  1107. a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
  1108. Location.No_Location, Location.Name_Location, CONVERT(decimal(18,6), 0) AS NumSum, CONVERT(decimal(18,6), 0) AS MoneySum,
  1109. CONVERT(decimal(18,6), 0) AS TaxSum, Employee.No_Employee AS No_Principal, Employee.Name_Employee AS Principal_SaleBill
  1110. FROM SaleBill
  1111. LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
  1112. LEFT JOIN AppUser a ON a.ID_User = SaleBill.ID_Creator
  1113. LEFT JOIN AppUser b ON b.ID_User = SaleBill.ID_Assessor
  1114. LEFT JOIN AppUser c ON c.ID_User = SaleBill.LastModUser_SaleBill
  1115. LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
  1116. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal">
  1117. <Tables>
  1118. <Table name="AllBill" />
  1119. </Tables>
  1120. </SearchAllBill>
  1121. <SearchAllCustomer CmdType="Text" CmdText="SELECT Customer.No_Customer,Customer.ShortName_Customer,Customer.Type_Customer,Customer.Level_Customer,Customer.IsGeneric_Customer FROM Customer ">
  1122. <Tables>
  1123. <Table name="AllCustomer" />
  1124. </Tables>
  1125. </SearchAllCustomer>
  1126. <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product FROM Product ">
  1127. <Tables>
  1128. <Table name="AllProduct" />
  1129. </Tables>
  1130. </SearchAllProduct>
  1131. <SearchPrincipal CmdType="Text" CmdText="SELECT DISTINCT No_Employee,Name_Employee
  1132. FROM Employee
  1133. ORDER BY No_Employee">
  1134. <Tables>
  1135. <Table name="Principal" />
  1136. </Tables>
  1137. </SearchPrincipal>
  1138. <SearchLocation CmdType="Text" CmdText=" SELECT Location.No_Location, Location.Name_Location FROM Location WHERE Location.Level_Location = 0 ORDER BY Location.No_Location">
  1139. <Tables>
  1140. <Table name="Location" />
  1141. </Tables>
  1142. </SearchLocation>
  1143. <SearchType CmdType="Text" CmdText=" SELECT Name_TypeDef as Type_Product FROM TypeDef WHERE (Type_TypeDef = 8) ORDER BY Name_TypeDef">
  1144. <Tables>
  1145. <Table name="Type"/>
  1146. </Tables>
  1147. </SearchType>
  1148. <SearchFrmSalesListLocation CmdType="Text" CmdText=" declare @cessIn decimal(14,4)
  1149. declare @sqlCmd nvarchar(4000)
  1150. Select @cessIn=CessIn_SystemSetting From SystemSetting
  1151. CREATE TABLE Get
  1152. ( StartDate DATETIME,
  1153. EndDate DATETIME,
  1154. StartNo_SaleBill nvarchar(64),
  1155. EndNo_SaleBill nvarchar(64),
  1156. StartNo_Customer nvarchar(64),
  1157. EndNo_Customer nvarchar(64),
  1158. StartNo_Principal nvarchar(64),
  1159. EndNo_Principal nvarchar(64),
  1160. StartNo_Location nvarchar(64),
  1161. EndNo_Location nvarchar(64),
  1162. StartNo_Product nvarchar(64),
  1163. EndNo_Product nvarchar(64),
  1164. StartType_Product nvarchar(64),
  1165. EndType_Product nvarchar(64),
  1166. Company nvarchar(64),
  1167. Name_Create nvarchar(64),
  1168. )
  1169. INSERT INTO Get(StartDate,EndDate,StartNo_SaleBill,EndNo_SaleBill,
  1170. StartNo_Customer,EndNo_Customer,StartNo_Principal,EndNo_Principal,
  1171. StartNo_Location,EndNo_Location,Company,Name_Create,
  1172. StartNo_Product,EndNo_Product,StartType_Product,EndType_Product)
  1173. VALUES (@StartDate,@EndDate,isnull(@StartNo_SaleBill,''),isnull(@EndNo_SaleBill,''),
  1174. isnull(@StartNo_Customer,''),isnull(@EndNo_Customer,''),isnull(@StartNo_Principal,''),isnull(@EndNo_Principal,''),
  1175. isnull(@StartNo_Location,''),isnull(@EndNo_Location,''),isnull(@Company,''),@Name_Create,
  1176. isnull(@StartNo_Product,''),isnull(@EndNo_Product,''),isnull(@StartType_Product,''),isnull(@EndType_Product,''))
  1177. SELECT * FROM Get
  1178. DROP TABLE Get
  1179. SELECT * FROM (
  1180. select top 0 '' as sg,'' as Name_Location,'' as No_Product,'' as Name_Product,convert(datetime,'') as Date_SaleBill,'' as No_SaleBill,
  1181. '' as ShortName_Customer,'' as Principal_SaleBill,Convert(decimal(14,2),0) as Quantity,'' as Unit_Product,
  1182. 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,
  1183. convert(decimal(14,2),0) as CurrencyAmount,CONVERT(Decimal(14,2),0) as TaxAmount
  1184. UNION ALL
  1185. (
  1186. SELECT sg=-1,Location.Name_Location,Product.No_Product,Product.Name_Product,SaleBill.Date_SaleBill,('销'+SaleBill.No_SaleBill) as No_SaleBill,
  1187. Customer.ShortName_Customer,Employee.Name_Employee as Principal_SaleBill,convert(DECIMAL(14,2),SUM(SaleBillProduct.Quantity_SaleBillProduct)) AS Quantity,Product.Unit_Product,
  1188. (UnitPrice_SaleBillProduct) AS Price_Product,
  1189. SaleBill.Currency_SaleBill,SaleBill.TaxCurrency_SaleBill,
  1190. MoneySum = case SaleBill.TaxCurrency_SaleBill
  1191. When '内含' Then convert(DECIMAL(14,2),sum( (Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)/(1+@cessIn/100)))
  1192. else convert(DECIMAL(14,2),SUM((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))) end,
  1193. Amount=case SaleBill.TaxCurrency_SaleBill
  1194. When '外加' Then convert(DECIMAL(14,2),sum((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(1+@cessIn/100)))
  1195. else convert(DECIMAL(14,2),SUM((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))) end,
  1196. CurrencyAmount=case SaleBill.TaxCurrency_SaleBill
  1197. When '外加' Then convert(DECIMAL(14,2),SUM((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(1+@cessIn/100)))
  1198. else convert(DECIMAL(14,2),SUM((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct))) end,
  1199. TaxAmount = case SaleBill.TaxCurrency_SaleBill
  1200. When '外加' Then convert(DECIMAL(14,2),SUM((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(@cessIn/100)))
  1201. When '内含' Then convert(DECIMAL(14,2),SUM((Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*((@cessIn/100)/(1+@cessIn/100))))
  1202. When '零税' Then 0
  1203. When '免税' Then 0 end
  1204. FROM SaleBill
  1205. LEFT JOIN SaleBillProduct ON SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill
  1206. LEFT JOIN Product ON Product.ID_Product = SaleBillProduct.ID_Product
  1207. LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
  1208. LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
  1209. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  1210. WHERE SaleBill.ID_Assessor IS NOT NULL
  1211. 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)
  1212. AND SaleBill.No_SaleBill BETWEEN ISNULL(@StartNo_SaleBill,SaleBill.No_SaleBill) AND ISNULL(@EndNo_SaleBill,SaleBill.No_SaleBill)
  1213. AND No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
  1214. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  1215. AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
  1216. AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
  1217. AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
  1218. And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
  1219. and Special_SaleBill=case @Special when 1 then Special_SaleBill else 0 End
  1220. GROUP BY Product.No_Product,Product.Name_Product,SaleBill.No_SaleBill,SaleBill.Date_SaleBill,
  1221. Customer.ShortName_Customer,Employee.Name_Employee,Location.Name_Location,
  1222. SaleBill.Currency_SaleBill,SaleBill.TaxCurrency_SaleBill,(UnitPrice_SaleBillProduct),Product.Unit_Product
  1223. )
  1224. UNION ALL
  1225. (
  1226. SELECT sg=1,Location.Name_Location,Product.No_Product,Product.Name_Product,SaleRtnBill.Date_SaleRtnBill AS Date_SaleBill,('退'+SaleRtnBill.No_SaleRtnBill) as No_SaleBill,
  1227. Customer.ShortName_Customer,Employee.Name_Employee as Principal_SaleBill,convert(DECIMAL(14,2),-SUM(SaleRtnBillProduct.Quantity_SaleRtnBillProduct)) AS Quantity,Product.Unit_Product,
  1228. (UnitPrice_SaleRtnBillProduct) AS Price_Product,
  1229. SaleRtnBill.Currency_SaleRtnBill as Currency_SaleBill,SaleRtnBill.TaxCurrency_SaleRtnBill as TaxCurrency_SaleBill,
  1230. MoneySum = CASE @Rtn WHEN 1 THEN (case SaleRtnBill.TaxCurrency_SaleRtnBill
  1231. When '内含' Then convert(DECIMAL(14,2),-sum( (Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)/(1+@cessIn/100)))
  1232. else convert(DECIMAL(14,2),-SUM((Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))) end) ELSE 0 END,
  1233. Amount=CASE @Rtn WHEN 1 THEN (case SaleRtnBill.TaxCurrency_SaleRtnBill
  1234. When '外加' Then convert(DECIMAL(14,2),-sum((Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*(1+@cessIn/100)))
  1235. else convert(DECIMAL(14,2),-SUM((Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))) end) ELSE 0 END,
  1236. CurrencyAmount=CASE @Rtn WHEN 1 THEN (case SaleRtnBill.TaxCurrency_SaleRtnBill
  1237. When '外加' Then convert(DECIMAL(14,2),-SUM((Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*(1+@cessIn/100)))
  1238. else convert(DECIMAL(14,2),-SUM((Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct))) end) ELSE 0 END,
  1239. TaxAmount = CASE @Rtn WHEN 1 THEN (case SaleRtnBill.TaxCurrency_SaleRtnBill
  1240. When '外加' Then convert(DECIMAL(14,2),-SUM((Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*(@cessIn/100)))
  1241. When '内含' Then convert(DECIMAL(14,2),-SUM((Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*((@cessIn/100)/(1+@cessIn/100))))
  1242. When '零税' Then 0
  1243. When '免税' Then 0 end) ELSE 0 END
  1244. FROM SaleRtnBill
  1245. LEFT JOIN SaleRtnBillProduct ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
  1246. LEFT JOIN Product ON Product.ID_Product = SaleRtnBillProduct.ID_Product
  1247. LEFT JOIN Location ON Location.ID_Location = SaleRtnBill.ID_Location
  1248. LEFT JOIN Customer ON Customer.ID_Customer = SaleRtnBill.ID_Customer
  1249. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
  1250. WHERE SaleRtnBill.ID_Assessor IS NOT NULL
  1251. 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)
  1252. AND SaleRtnBill.No_SaleRtnBill BETWEEN ISNULL(@StartNo_SaleBill,SaleRtnBill.No_SaleRtnBill) AND ISNULL(@EndNo_SaleBill,SaleRtnBill.No_SaleRtnBill)
  1253. AND No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
  1254. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  1255. AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
  1256. AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
  1257. AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
  1258. And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
  1259. GROUP BY Product.No_Product,Product.Name_Product,SaleRtnBill.No_SaleRtnBill,SaleRtnBill.Date_SaleRtnBill,
  1260. Customer.ShortName_Customer,Employee.Name_Employee,Location.Name_Location,
  1261. SaleRtnBill.Currency_SaleRtnBill,SaleRtnBill.TaxCurrency_SaleRtnBill,(UnitPrice_SaleRtnBillProduct),Product.Unit_Product
  1262. )
  1263. ) C
  1264. WHERE MoneySum != 0 AND Amount != 0 AND CurrencyAmount != 0 --AND TaxAmount != 0
  1265. ORDER BY C.Name_Location,No_Product,sg,Date_SaleBill
  1266. ">
  1267. <Params>
  1268. <Param name="@StartDate" type="SaleBill.Date_SaleBill" Index="0" />
  1269. <Param name="@EndDate" type="SaleBill.Date_SaleBill" Index="1" />
  1270. <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
  1271. <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
  1272. <Param name="@StartNo_Customer" type="SaleBill.No_Customer" Index="4" />
  1273. <Param name="@EndNo_Customer" type="SaleBill.No_Customer" Index="5" />
  1274. <Param name="@StartNo_Principal" type="SaleBill.No_Customer" Index="6" />
  1275. <Param name="@EndNo_Principal" type="SaleBill.No_Customer" Index="7" />
  1276. <Param name="@StartNo_Location" type="SaleBill.No_Location" Index="8" />
  1277. <Param name="@EndNo_Location" type="SaleBill.No_Location" Index="9" />
  1278. <Param name="@StartNo_Product" type="SaleBill.No_Product" Index="10" />
  1279. <Param name="@EndNo_Product" type="SaleBill.No_Product" Index="11" />
  1280. <Param name="@StartType_Product" type="SaleBill.Type_Product" Index="12" />
  1281. <Param name="@EndType_Product" type="SaleBill.Type_Product" Index="13" />
  1282. <Param name="@Company" type="SaleBill.Type_Product" Index="14" />
  1283. <Param name="@Name_Create" type="SaleBill.Name_Location" Index="15" />
  1284. <Param name="@Right" type="SaleBill.ID_Customer" Index="16" />
  1285. <Param name="@Rtn" type="Product.No_Product" Index="17" />
  1286. <Param name="@Special" type="SaleBill.Special_SaleBill" Index="18" />
  1287. </Params>
  1288. <Tables>
  1289. <Table name="Get" />
  1290. <Table name="FrmSalesListLocation"/>
  1291. </Tables>
  1292. </SearchFrmSalesListLocation>
  1293. <SearchFrmSalesList CmdType="Text" CmdText="declare @cessIn decimal(14,4)
  1294. declare @sqlCmd nvarchar(4000)
  1295. Select @cessIn=CessIn_SystemSetting From SystemSetting
  1296. CREATE TABLE Get
  1297. (
  1298. StartDate DATETIME,
  1299. EndDate DATETIME,
  1300. StartNo_SaleBill nvarchar(64),
  1301. EndNo_SaleBill nvarchar(64),
  1302. StartNo_Customer nvarchar(64),
  1303. EndNo_Customer nvarchar(64),
  1304. StartNo_Principal nvarchar(64),
  1305. EndNo_Principal nvarchar(64),
  1306. StartNo_Location nvarchar(64),
  1307. EndNo_Location nvarchar(64),
  1308. StartNo_Product nvarchar(64),
  1309. EndNo_Product nvarchar(64),
  1310. StartType_Product nvarchar(64),
  1311. EndType_Product nvarchar(64),
  1312. Company nvarchar(64),
  1313. Name_Create nvarchar(64)
  1314. )
  1315. INSERT INTO Get(StartDate,EndDate,StartNo_SaleBill,EndNo_SaleBill,
  1316. StartNo_Customer,EndNo_Customer,StartNo_Principal,EndNo_Principal,
  1317. StartNo_Location,EndNo_Location,Company,Name_Create,
  1318. StartNo_Product,EndNo_Product,StartType_Product,EndType_Product)
  1319. VALUES (@StartDate,@EndDate,isnull(@StartNo_SaleBill,''),isnull(@EndNo_SaleBill,''),
  1320. isnull(@StartNo_Customer,''),isnull(@EndNo_Customer,''),isnull(@StartNo_Principal,''),isnull(@EndNo_Principal,''),
  1321. isnull(@StartNo_Location,''),isnull(@EndNo_Location,''),isnull(@Company,''),@Name_Create,
  1322. isnull(@StartNo_Product,''),isnull(@EndNo_Product,''),isnull(@StartType_Product,''),isnull(@EndType_Product,''))
  1323. SELECT * FROM Get
  1324. DROP TABLE Get
  1325. 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,
  1326. '' 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,
  1327. '' 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
  1328. union all
  1329. (
  1330. SELECT '销' as BillType,Employee.Name_Employee as Principal_SaleBill,Customer.ShortName_Customer,(SaleBill.No_SaleBill) as No_SaleBill,SaleBill.Date_SaleBill,
  1331. Location.Name_Location,SaleBill.Currency_SaleBill,SaleBill.TaxCurrency_SaleBill,
  1332. MoneySum = case SaleBill.TaxCurrency_SaleBill
  1333. When '内含' Then convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)/(1+@cessIn/100))
  1334. else convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)) end,
  1335. Amount=case SaleBill.TaxCurrency_SaleBill
  1336. When '外加' Then convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(1+@cessIn/100))
  1337. else convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)) end,
  1338. CurrencyAmount=case SaleBill.TaxCurrency_SaleBill
  1339. When '外加' Then convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(1+@cessIn/100))
  1340. else convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)) end,
  1341. TaxAmount = case SaleBill.TaxCurrency_SaleBill
  1342. When '外加' Then convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*(@cessIn/100))
  1343. When '内含' Then convert(decimal(14,2),(Quantity_SaleBillProduct*UnitPrice_SaleBillProduct)*((@cessIn/100)/(1+@cessIn/100)))
  1344. When '零税' Then 0
  1345. When '免税' Then 0 end,Product.No_Product,Product.Name_Product,SaleBillProduct.Quantity_SaleBillProduct,
  1346. Product.Unit_Product,(UnitPrice_SaleBillProduct) AS Price_Product,
  1347. (UnitPrice_SaleBillProduct*Quantity_SaleBillProduct) AS ProductMoney,No_Customer
  1348. FROM SaleBill
  1349. LEFT JOIN Location ON Location.ID_Location = SaleBill.ID_Location
  1350. LEFT JOIN SaleBillProduct ON SaleBill.ID_SaleBill=SaleBillProduct.ID_SaleBill
  1351. LEFT JOIN Customer ON Customer.ID_Customer = SaleBill.ID_Customer
  1352. LEFT JOIN Employee ON Employee.ID_Employee = SaleBill.ID_Principal
  1353. LEFT JOIN Product ON Product.ID_Product = SaleBillProduct.ID_Product
  1354. WHERE SaleBill.ID_Assessor IS NOT NULL
  1355. 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)
  1356. AND SaleBill.No_SaleBill BETWEEN ISNULL(@StartNo_SaleBill,SaleBill.No_SaleBill) AND ISNULL(@EndNo_SaleBill,SaleBill.No_SaleBill)
  1357. AND No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
  1358. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  1359. AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
  1360. AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
  1361. AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
  1362. And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
  1363. and Special_SaleBill=case @Special when 1 then Special_SaleBill else 0 End
  1364. )
  1365. union all
  1366. (
  1367. SELECT '退' as BiiType,Employee.Name_Employee as Principal_SaleBill,Customer.ShortName_Customer,(SaleRtnBill.No_SaleRtnBill) as No_SaleBill,(SaleRtnBill.Date_SaleRtnBill) as Date_SaleBill,
  1368. Location.Name_Location,SaleRtnBill.Currency_SaleRtnBill,SaleRtnBill.TaxCurrency_SaleRtnBill,
  1369. MoneySum = case SaleRtnBill.TaxCurrency_SaleRtnBill
  1370. When '内含' Then convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)/(1+@cessIn/100))
  1371. else convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)) end,
  1372. Amount=case SaleRtnBill.TaxCurrency_SaleRtnBill
  1373. When '外加' Then convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*(1+@cessIn/100))
  1374. else convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)) end,
  1375. CurrencyAmount=case SaleRtnBill.TaxCurrency_SaleRtnBill
  1376. When '外加' Then convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*(1+@cessIn/100))
  1377. else convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)) end,
  1378. TaxAmount = case SaleRtnBill.TaxCurrency_SaleRtnBill
  1379. When '外加' Then convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*(@cessIn/100))
  1380. When '内含' Then convert(decimal(14,2),-(Quantity_SaleRtnBillProduct*UnitPrice_SaleRtnBillProduct)*((@cessIn/100)/(1+@cessIn/100)))
  1381. When '零税' Then 0
  1382. When '免税' Then 0 end,Product.No_Product,Product.Name_Product,-SaleRtnBillProduct.Quantity_SaleRtnBillProduct as Quantity_SaleBillProduct,
  1383. Product.Unit_Product,(UnitPrice_SaleRtnBillProduct) AS Price_Product,
  1384. -(UnitPrice_SaleRtnBillProduct*Quantity_SaleRtnBillProduct) AS ProductMoney,No_Customer
  1385. FROM SaleRtnBill
  1386. LEFT JOIN Location ON Location.ID_Location = SaleRtnBill.ID_Location
  1387. LEFT JOIN SaleRtnBillProduct ON SaleRtnBill.ID_SaleRtnBill=SaleRtnBillProduct.ID_SaleRtnBill
  1388. LEFT JOIN Customer ON Customer.ID_Customer = SaleRtnBill.ID_Customer
  1389. LEFT JOIN Employee ON Employee.ID_Employee = SaleRtnBill.ID_Principal
  1390. LEFT JOIN Product ON Product.ID_Product = SaleRtnBillProduct.ID_Product
  1391. WHERE SaleRtnBill.ID_Assessor IS NOT NULL
  1392. 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)
  1393. AND SaleRtnBill.No_SaleRtnBill BETWEEN ISNULL(@StartNo_SaleBill,SaleRtnBill.No_SaleRtnBill) AND ISNULL(@EndNo_SaleBill,SaleRtnBill.No_SaleRtnBill)
  1394. AND No_Customer BETWEEN ISNULL(@StartNo_Customer,No_Customer) AND ISNULL(@EndNo_Customer,No_Customer)
  1395. AND Employee.No_Employee BETWEEN ISNULL(@StartNo_Principal,No_Employee) AND ISNULL(@EndNo_Principal,No_Employee)
  1396. AND Location.No_Location BETWEEN ISNULL(@StartNo_Location,Location.No_Location) AND ISNULL(@EndNo_Location,Location.No_Location)
  1397. AND Product.Type_Product BETWEEN ISNULL(@StartType_Product,Product.Type_Product) AND ISNULL(@EndType_Product,Product.Type_Product)
  1398. AND Product.No_Product BETWEEN ISNULL(@StartNo_Product,Product.No_Product) AND ISNULL(@EndNo_Product,Product.No_Product)
  1399. And Customer.ID_Creator = ISNULL(@Right,Customer.ID_Creator)
  1400. and @Rtn =1
  1401. )
  1402. order by BillType desc,Date_SaleBill">
  1403. <Params>
  1404. <Param name="@StartDate" type="SaleBill.Date_SaleBill" Index="0" />
  1405. <Param name="@EndDate" type="SaleBill.Date_SaleBill" Index="1" />
  1406. <Param name="@StartNo_SaleBill" type="SaleBill.No_SaleBill" Index="2" />
  1407. <Param name="@EndNo_SaleBill" type="SaleBill.No_SaleBill" Index="3" />
  1408. <Param name="@StartNo_Customer" type="SaleBill.No_Customer" Index="4" />
  1409. <Param name="@EndNo_Customer" type="SaleBill.No_Customer" Index="5" />
  1410. <Param name="@StartNo_Principal" type="SaleBill.No_Customer" Index="6" />
  1411. <Param name="@EndNo_Principal" type="SaleBill.No_Customer" Index="7" />
  1412. <Param name="@StartNo_Location" type="SaleBill.No_Location" Index="8" />
  1413. <Param name="@EndNo_Location" type="SaleBill.No_Location" Index="9" />
  1414. <Param name="@StartNo_Product" type="SaleBill.No_Product" Index="10" />
  1415. <Param name="@EndNo_Product" type="SaleBill.No_Product" Index="11" />
  1416. <Param name="@StartType_Product" type="SaleBill.Type_Product" Index="12" />
  1417. <Param name="@EndType_Product" type="SaleBill.Type_Product" Index="13" />
  1418. <Param name="@Company" type="SaleBill.Type_Product" Index="14" />
  1419. <Param name="@Name_Create" type="SaleBill.Name_Location" Index="15" />
  1420. <Param name="@Right" type="SaleBill.ID_Customer" Index="16" />
  1421. <Param name="@Rtn" type="Product.No_Product" Index="17" />
  1422. <Param name="@Special" type="SaleBill.Special_SaleBill" Index="18" />
  1423. </Params>
  1424. <Tables>
  1425. <Table name="Get" />
  1426. <Table name="FrmSalesList"/>
  1427. </Tables>
  1428. </SearchFrmSalesList>
  1429. </Search>
  1430. </Server>
  1431. <Lables>
  1432. <Search>
  1433. </Search>
  1434. </Lables>
  1435. </Form>
  1436. </Forms>