FrmBonusPerformanceTables.xml 102 KB

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