HireDress.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. // HireDress.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "HireDress.h"
  6. #include "ShowPhoto.h"
  7. #include "ShowEarlyWarning.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // HireDress IDC_EDITtime3 12
  15. HireDress::HireDress(CWnd* pParent /*=NULL*/)
  16. : CDialog(HireDress::IDD, pParent)
  17. {
  18. //{{AFX_DATA_INIT(HireDress)
  19. m_addr2 = _T("");
  20. m_name2 = _T("");
  21. m_occupation2 = _T("");
  22. m_phone2 = _T("");
  23. m_qq2 = _T("");
  24. m_birthday2 = _T("");
  25. m_time3 = _T("");
  26. m_id = _T("");
  27. m_money = _T("");
  28. m_money2 = _T("");
  29. m_inputdate = g_date;
  30. m_clerk = g_user.name ;
  31. m_balance = _T("");
  32. m_count = _T("");
  33. m_no = _T("");
  34. m_remark = _T("");
  35. m_date1 = _T("");
  36. m_date2 = _T("");
  37. m_bAdd=1;
  38. m_pImg=NULL;
  39. m_bIsSale=0;
  40. m_radio1 = 0;
  41. //}}AFX_DATA_INIT
  42. }
  43. void HireDress::DoDataExchange(CDataExchange* pDX)
  44. {
  45. CDialog::DoDataExchange(pDX);
  46. //{{AFX_DATA_MAP(HireDress)
  47. DDX_Control(pDX, IDC_EDITdate2, m_datectrl5);
  48. DDX_Control(pDX, IDC_EDITdate1, m_datectrl4);
  49. DDX_Control(pDX, IDC_EDITcount, m_editctrl3);
  50. DDX_Control(pDX, IDC_EDITmoney2, m_editctrl2);
  51. DDX_Control(pDX, IDC_EDITmoney, m_editctrl);
  52. DDX_Control(pDX, IDC_LIST4, m_List1);
  53. DDX_Control(pDX, IDC_COMBOname, m_comboname);
  54. DDX_Control(pDX, IDC_EDITtime3, m_datectrl3);
  55. DDX_Control(pDX, IDC_EDITBirthday2, m_datectrl2);
  56. DDX_Text(pDX, IDC_EDITaddr2, m_addr2);
  57. DDX_Text(pDX, IDC_EDITname2, m_name2);
  58. DDX_Text(pDX, IDC_EDITOccupation2, m_occupation2);
  59. DDX_Text(pDX, IDC_EDITphone2, m_phone2);
  60. DDX_Text(pDX, IDC_EDITqq2, m_qq2);
  61. DDX_Text(pDX, IDC_EDITBirthday2, m_birthday2);
  62. DDX_Text(pDX, IDC_EDITtime3, m_time3);
  63. DDX_Text(pDX, IDC_EDITid, m_id);
  64. DDX_Text(pDX, IDC_EDITmoney, m_money);
  65. DDX_Text(pDX, IDC_EDITmoney2, m_money2);
  66. DDX_Text(pDX, IDC_EDITinputdate, m_inputdate);
  67. DDX_Text(pDX, IDC_EDITclerk, m_clerk);
  68. DDX_Text(pDX, IDC_EDITbalance, m_balance);
  69. DDX_Text(pDX, IDC_EDITcount, m_count);
  70. DDX_Text(pDX, IDC_EDITno, m_no);
  71. DDX_Text(pDX, IDC_EDITremark, m_remark);
  72. DDV_MaxChars(pDX, m_remark, 1000);
  73. DDX_Text(pDX, IDC_EDITdate1, m_date1);
  74. DDX_Text(pDX, IDC_EDITdate2, m_date2);
  75. DDX_Radio(pDX, IDC_RADIO1, m_radio1);
  76. //}}AFX_DATA_MAP
  77. }
  78. BEGIN_MESSAGE_MAP(HireDress, CDialog)
  79. //{{AFX_MSG_MAP(HireDress)
  80. ON_CBN_SELCHANGE(IDC_COMBOname, OnSelchangeCOMBOname)
  81. ON_WM_DESTROY()
  82. ON_WM_PAINT()
  83. ON_BN_CLICKED(IDC_BUTTON1, OnAddDress)
  84. ON_BN_CLICKED(IDC_BUTTON2, OnDelDress)
  85. ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
  86. ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
  87. ON_BN_CLICKED(IDC_STATIC4, OnStatic4)
  88. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  89. //}}AFX_MSG_MAP
  90. END_MESSAGE_MAP()
  91. /////////////////////////////////////////////////////////////////////////////
  92. // HireDress message handlers
  93. BOOL HireDress::OnInitDialog()
  94. {
  95. CDialog::OnInitDialog();
  96. if(m_bAdd)
  97. {
  98. if(m_bIsSale)
  99. {
  100. SetWindowText("礼服出售单");
  101. GetDlgItem(IDC_STATIC10)->ShowWindow(SW_HIDE);
  102. GetDlgItem(IDC_EDITdate2)->ShowWindow(SW_HIDE);
  103. }
  104. CString sql="select max(id) as cot from dresshire where [date]='"+g_date+"'";
  105. g_sendhead.bsql=1;
  106. g_pMainWnd->ProcessChatMessageRequest2(sql);
  107. if(g_bSendOK==0)
  108. {
  109. CDialog::OnCancel ();
  110. return false;
  111. }
  112. CString date=g_date;
  113. date.Replace ("-", "");
  114. m_id.Format ("%s-(lf)%03d", date, g_ncount+1);
  115. g_sendhead.bsql=0;
  116. g_sendhead.code[0]=72;
  117. g_sendhead.tabcount=1;
  118. g_pMainWnd->ProcessChatMessageRequest2(0);
  119. if(g_bSendOK==0)
  120. {
  121. CDialog::OnCancel ();
  122. return false;
  123. }
  124. DataToArray(&m_List1array);
  125. TypeChange();
  126. }
  127. else
  128. {
  129. if(m_bIsSale)
  130. {
  131. SetWindowText("礼服出售单修改");
  132. GetDlgItem(IDC_STATIC10)->ShowWindow(SW_HIDE);
  133. GetDlgItem(IDC_EDITdate2)->ShowWindow(SW_HIDE);
  134. }
  135. else
  136. SetWindowText("礼服出租单修改");
  137. CString filter=";id='"+m_id+"';id='"+m_id+"';id='"+m_id+"'";
  138. g_sendhead.bsql=0;
  139. g_sendhead.code[0]=72;
  140. g_sendhead.code[1]=73;
  141. g_sendhead.code[2]=74;
  142. g_sendhead.code[3]=52;
  143. g_sendhead.tabcount=4;
  144. g_pMainWnd->ProcessChatMessageRequest2(filter);
  145. if(g_bSendOK==0)
  146. {
  147. CDialog::OnCancel ();
  148. return false;
  149. }
  150. CArray<CStringArray, CStringArray>dresshirearray;
  151. CArray<CStringArray, CStringArray>dresshiredataarray;
  152. CArray<CStringArray, CStringArray>clientarray;
  153. DataToArray(&m_List1array, &dresshirearray, &dresshiredataarray, &clientarray);
  154. if(dresshirearray.GetSize ())
  155. {
  156. m_money = dresshirearray.ElementAt (0).ElementAt (1);
  157. m_money2 = dresshirearray.ElementAt (0).ElementAt (2);
  158. m_remark = dresshirearray.ElementAt (0).ElementAt (10);
  159. m_inputdate = dresshirearray.ElementAt (0).ElementAt (6);
  160. m_date1 = dresshirearray.ElementAt (0).ElementAt (7);
  161. m_date2 = dresshirearray.ElementAt (0).ElementAt (8);
  162. m_clerk = g_user.name ;
  163. }
  164. if(clientarray.GetSize ())
  165. {
  166. m_name2=clientarray.ElementAt (0).ElementAt (2);
  167. m_phone2=clientarray.ElementAt (0).ElementAt (4);
  168. m_qq2=clientarray.ElementAt (0).ElementAt (6);
  169. m_addr2=clientarray.ElementAt (0).ElementAt (8);
  170. m_occupation2=clientarray.ElementAt (0).ElementAt (10);
  171. m_birthday2=clientarray.ElementAt (0).ElementAt (12);
  172. m_time3=clientarray.ElementAt (0).ElementAt (20);
  173. }
  174. for(int i=0; i<dresshiredataarray.GetSize (); i++)
  175. {
  176. m_needgetbalancearray.Add (dresshiredataarray.ElementAt (i).ElementAt (1));
  177. m_seldressarray.Add (dresshiredataarray.ElementAt (i).ElementAt (1));
  178. m_seldressarray.Add (dresshiredataarray.ElementAt (i).ElementAt (2));
  179. m_seldressarray.Add (dresshiredataarray.ElementAt (i).ElementAt (3));
  180. m_seldressarray.Add (m_id);
  181. m_seldressarray.Add (dresshiredataarray.ElementAt (i).ElementAt (4));
  182. m_seldressarray.Add (dresshiredataarray.ElementAt (i).ElementAt (7));
  183. CString str;
  184. str=dresshiredataarray.ElementAt (i).ElementAt (2);
  185. str+="\r\n数量:";
  186. str+=dresshiredataarray.ElementAt (i).ElementAt (3);
  187. if(m_List1.GetCount()%2)
  188. m_List1.AddEntry( str , g_gridcol1, m_List1.GetCount());
  189. else
  190. m_List1.AddEntry( str , g_gridcol2, m_List1.GetCount());
  191. }
  192. TypeChange();
  193. }
  194. if(m_bIsSale)
  195. GetDlgItem(IDC_STATIC1)->SetWindowText("出售资料");
  196. CenterWindow();
  197. UpdateData(false);
  198. return TRUE; // return TRUE unless you set the focus to a control
  199. // EXCEPTION: OCX Property Pages should return FALSE
  200. }
  201. void HireDress::OnOK()
  202. {
  203. // TODO: Add extra validation here
  204. UpdateData();
  205. m_money.TrimLeft ();m_money.TrimRight ();
  206. m_money2.TrimLeft ();m_money2.TrimRight ();
  207. m_name2.TrimLeft ();m_name2.TrimRight ();
  208. m_phone2.TrimLeft ();m_phone2.TrimRight ();
  209. if(!CheckDateOK(m_birthday2))return;
  210. if(!CheckDateOK(m_time3))return;
  211. if(!CheckDateOK(m_date1))return;
  212. if(m_bIsSale)
  213. {
  214. m_date2="..";
  215. }
  216. else
  217. {
  218. if(!CheckDateOK(m_date2))return;
  219. }
  220. if(m_money.IsEmpty () || m_money2.IsEmpty () || m_name2.IsEmpty () || m_phone2.IsEmpty () || m_money.IsEmpty () )
  221. {
  222. AfxMessageBox("资料不全, 打*号的项目为必填项目!");
  223. return;
  224. }
  225. if(m_bIsSale==0)
  226. {
  227. if(m_date1.IsEmpty () || m_date2.IsEmpty ())
  228. {
  229. AfxMessageBox("资料不全, 打*号的项目为必填项目!");
  230. return;
  231. }
  232. }
  233. if( m_seldressarray.GetSize()==0 )
  234. {
  235. AfxMessageBox("礼服资料未添加!");
  236. return;
  237. }
  238. if(0)//m_bIsSale==0)//计算是否撞期
  239. {
  240. CString str,time1,time2,hireorsale,no,count;
  241. CTimeSpan dt(1, 0, 0, 0);
  242. for(int i=0; i<m_seldressarray.GetSize (); i+=6)
  243. {
  244. no=m_seldressarray.ElementAt (i);count=m_seldressarray.ElementAt (i+2);
  245. if(GetCountFromNo(no)>atoi(count))continue;
  246. CString filter="[no]='"+no+"'";
  247. g_sendhead.bsql=0;
  248. g_sendhead.code[0]=191;
  249. g_sendhead.tabcount=1;
  250. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  251. CArray<CStringArray, CStringArray>m_List1array;
  252. DataToArray(&m_List1array);
  253. for(int j=0; j<m_List1array.GetSize (); j++)
  254. {
  255. hireorsale=m_List1array.ElementAt (j).ElementAt(4);
  256. if(hireorsale=="售")continue;
  257. time1=m_List1array.ElementAt (j).ElementAt(2);
  258. time2=m_List1array.ElementAt (j).ElementAt(3);
  259. if(CheckDateOK(time1) && CheckDateOK(time2))
  260. {
  261. CTime tm1(atoi(time1.Mid (0,4)),atoi(time1.Mid (5,2)),atoi(time1.Mid (8,2)),0,0,0);
  262. CTime tm2(atoi(time2.Mid (0,4)),atoi(time2.Mid (5,2)),atoi(time2.Mid (8,2)),0,0,0);
  263. CTime tm=tm2;
  264. tm+=dt;
  265. if(tm.Format ("%Y-%m-%d")==m_date1)
  266. {
  267. str.Format ("礼服:%s归还日与取件日只差一天! 是否继续?", no);
  268. if(AfxMessageBox(str, MB_YESNO|MB_ICONINFORMATION)!=IDYES)return;
  269. }
  270. }
  271. }
  272. }
  273. }
  274. CString sql,sql2;
  275. CString hireorsale="租";
  276. if(m_bIsSale)hireorsale="售";
  277. if(m_bAdd)
  278. {
  279. sql.Format ("insert into [dresshire]([id],[money],[money2],[date],[clerk],[hireorsale],[remark],[name],[phone],[date1],[date2])values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')",m_id,m_money,m_money2,m_inputdate,m_clerk,hireorsale,m_remark,m_name2,m_phone2,m_date1,m_date2);
  280. sql2.Format ("***insert into [client]([name2],[phone2],[qq2],[addr2],[occupation2],[birthday2],[time3],[id])values('%s','%s','%s','%s','%s','%s','%s','%s')",m_name2,m_phone2,m_qq2,m_addr2,m_occupation2,m_birthday2,m_time3,m_id);
  281. }
  282. else
  283. {
  284. sql="update [dresshire] set [money]='"+m_money+"',[money2]='"+m_money2+"',[clerk]='"+m_clerk+"',[remark]='"+m_remark+"',[name]='"+m_name2+"',[phone]='"+m_phone2+"',[date1]='"+m_date1+"',[date2]='"+m_date2+"' where [id]='"+m_id+"'";
  285. sql2.Format ("***update [client] set [name2]='%s',[phone2]='%s',[qq2]='%s',[addr2]='%s',[occupation2]='%s',[birthday2]='%s',[time3]='%s' where [id]='%s' ", m_name2,m_phone2,m_qq2,m_addr2,m_occupation2,m_birthday2,m_time3,m_id);
  286. }
  287. sql+=sql2;
  288. g_sendhead.bsql=1;
  289. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  290. CStringArray m_seldressarraybak;
  291. m_seldressarraybak.Copy (m_seldressarray);
  292. int count=m_seldressarray.GetSize ();
  293. CString str;
  294. str.Format ("%d", count);
  295. for(int i=0; i<m_needgetbalancearray.GetSize (); i++)
  296. {
  297. m_seldressarray.Add (m_needgetbalancearray.ElementAt (i));
  298. }
  299. m_seldressarray.Add (str);
  300. m_seldressarray.Add (m_date1);
  301. m_seldressarray.Add (m_date2);
  302. CMemFile memfile;
  303. CArchive ar(&memfile, CArchive::store);
  304. m_seldressarray.Serialize (ar);
  305. ar.Close();
  306. int length=memfile.GetLength ();
  307. BYTE *pData = memfile.Detach();
  308. g_nSendCode=20;
  309. g_pMainWnd->ProcessChatMessageRequest2(pData, length);
  310. g_nSendCode=0;
  311. delete []pData;
  312. m_seldressarray.RemoveAll ();
  313. m_seldressarray.Copy (m_seldressarraybak);
  314. if(g_bSendOK==0)return;
  315. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  316. CDialog::OnOK();
  317. }
  318. void HireDress::OnSelchangeCOMBOname()
  319. {
  320. // TODO: Add your control notification handler code here
  321. int pos=m_comboname.GetCurSel ();
  322. if(pos==-1)return;
  323. UpdateData();
  324. CString name;
  325. m_comboname.GetLBText (pos, name);
  326. for(int i=0; i<m_List1array.GetSize (); i++)
  327. {
  328. if(name==m_List1array.ElementAt (i).ElementAt (2))
  329. {
  330. m_no=m_List1array.ElementAt (i).ElementAt (1);
  331. m_balance=m_List1array.ElementAt (i).ElementAt (4);
  332. m_sellcot=m_List1array.ElementAt (i).ElementAt (6);
  333. CString savepath=g_path5+"\\";
  334. if(m_pImg)delete m_pImg;m_pImg=NULL;
  335. if(PathFileExists( savepath+""+m_no+".jpg" ) )
  336. {
  337. ::LoadImageFromBuf (&m_pImg, savepath+""+m_no+".jpg");
  338. }
  339. CRect rc;
  340. GetDlgItem(IDC_STATIC4)->GetWindowRect(rc);
  341. ScreenToClient(rc);
  342. InvalidateRect(rc);
  343. UpdateData(false);
  344. }
  345. }
  346. }
  347. void HireDress::OnDestroy()
  348. {
  349. // TODO: Add your message handler code here
  350. if(m_pImg)delete m_pImg;m_pImg=NULL;
  351. CDialog::OnDestroy();
  352. }
  353. void HireDress::OnPaint()
  354. {
  355. CPaintDC dc(this); // device context for painting
  356. // TODO: Add your message handler code here
  357. if(m_pImg)
  358. {
  359. CRect rc;
  360. GetDlgItem(IDC_STATIC4)->GetWindowRect(rc);
  361. ScreenToClient(rc);
  362. RectFitDes(m_pImg->GetWidth(), m_pImg->GetHeight(), rc);
  363. Graphics dcgraph(dc.GetSafeHdc());
  364. Rect destinationRect(rc.left , rc.top , rc.Width (), rc.Height ());
  365. dcgraph.DrawImage(m_pImg, destinationRect, 0,0,m_pImg->GetWidth(), m_pImg->GetHeight(),UnitPixel);
  366. }
  367. // Do not call CDialog::OnPaint() for painting messages
  368. }
  369. void HireDress::OnAddDress()
  370. {
  371. // TODO: Add your control notification handler code here
  372. UpdateData();
  373. int pos=m_comboname.GetCurSel ();
  374. if(pos==-1)return;
  375. CString name;
  376. m_comboname.GetLBText (pos, name);
  377. m_count.TrimLeft ();m_count.TrimRight ();
  378. if(atoi(m_count)<1)
  379. {
  380. AfxMessageBox("数量不能为空!");
  381. return;
  382. }
  383. if(atoi(m_count)>atoi(m_balance))
  384. {
  385. // AfxMessageBox("库存不足!");
  386. // return;
  387. }
  388. for(int i=0; i<m_seldressarray.GetSize (); i+=6)
  389. {
  390. if(name==m_seldressarray.ElementAt (i+1))
  391. {
  392. AfxMessageBox("已有此礼服的记录!");
  393. return;
  394. }
  395. }
  396. if(CheckEarlyWarning())
  397. {
  398. if(m_bIsSale)
  399. {
  400. if(AfxMessageBox("此日期礼服可能未回,是否继续开出售单?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)return;
  401. }
  402. else
  403. return;
  404. }
  405. m_needgetbalancearray.Add (m_no);
  406. m_seldressarray.Add (m_no);
  407. m_seldressarray.Add (name);
  408. m_seldressarray.Add (m_count);
  409. m_seldressarray.Add (m_id);
  410. m_seldressarray.Add ("");
  411. if(m_bIsSale)
  412. m_seldressarray.Add ("售");
  413. else
  414. m_seldressarray.Add ("租");
  415. CString str;
  416. str=name;
  417. str+="\r\n数量:";
  418. str+=m_count;
  419. if(m_List1.GetCount()%2)
  420. m_List1.AddEntry( str , g_gridcol1, m_List1.GetCount());
  421. else
  422. m_List1.AddEntry( str , g_gridcol2, m_List1.GetCount());
  423. }
  424. void HireDress::OnDelDress()
  425. {
  426. // TODO: Add your control notification handler code here
  427. int pos=m_List1.GetCurSel ();
  428. if(pos==-1)
  429. {
  430. AfxMessageBox("请先选中您要删除的礼服!");
  431. return;
  432. }
  433. m_List1.DeleteString (pos);
  434. pos*=6;
  435. if(m_bAdd==0)
  436. m_needgetbalancearray.Add (m_seldressarray.ElementAt (pos));
  437. m_seldressarray.RemoveAt(pos+5);
  438. m_seldressarray.RemoveAt(pos+4);
  439. m_seldressarray.RemoveAt(pos+3);
  440. m_seldressarray.RemoveAt(pos+2);
  441. m_seldressarray.RemoveAt(pos+1);
  442. m_seldressarray.RemoveAt(pos);
  443. }
  444. int HireDress::GetCountFromNo(CString no)
  445. {
  446. /* for(int i=0; i<m_List1array.GetSize (); i++)
  447. {
  448. if(no==m_List1array.ElementAt (i).ElementAt (1))
  449. {
  450. return atoi(m_List1array.ElementAt (i).ElementAt (8));
  451. }
  452. }*/
  453. return 0;
  454. }
  455. void HireDress::OnRadio1()
  456. {
  457. // TODO: Add your control notification handler code here
  458. OnRadio2();
  459. }
  460. void HireDress::OnRadio2()
  461. {
  462. // TODO: Add your control notification handler code here
  463. UpdateData();
  464. TypeChange();
  465. }
  466. void HireDress::OnStatic4()
  467. {
  468. // TODO: Add your control notification handler code here
  469. if(m_pImg)
  470. {
  471. ShowPhoto dlg;
  472. dlg.m_pImg=m_pImg;
  473. dlg.DoModal();
  474. }
  475. }
  476. void HireDress::TypeChange()
  477. {
  478. m_comboname.ResetContent();
  479. for(int i=0; i<m_List1array.GetSize (); i++)
  480. {
  481. if(m_radio1!=atoi(m_List1array.ElementAt (i).ElementAt (12)))continue;
  482. m_comboname.AddString (m_List1array.ElementAt (i).ElementAt (2));
  483. }
  484. }
  485. void HireDress::OnButton3()
  486. {
  487. // TODO: Add your control notification handler code here
  488. UpdateData();
  489. if(!CheckDateOK(m_date1))return;
  490. if(m_date1.IsEmpty () || m_no.IsEmpty () || m_count.IsEmpty ())
  491. {
  492. AfxMessageBox("取件日期和编号和数量为必填项目!");
  493. return;
  494. }
  495. if(m_bIsSale==0)
  496. {
  497. if(!CheckDateOK(m_date2))return;
  498. if(m_date2.IsEmpty ())
  499. {
  500. AfxMessageBox("取件日期和编号和数量为必填项目!");
  501. return;
  502. }
  503. }
  504. int pos=m_comboname.GetCurSel ();
  505. if(pos==-1)return;
  506. UpdateData();
  507. CString name;
  508. m_comboname.GetLBText (pos, name);
  509. ShowEarlyWarning dlg;
  510. dlg.m_no=m_no;
  511. dlg.m_name=name;
  512. dlg.m_cot1=m_balance;
  513. dlg.m_cot2=m_sellcot;
  514. dlg.m_cot3=m_count;
  515. dlg.m_date1=m_date1;
  516. if(m_bIsSale==0)dlg.m_date2=m_date2;
  517. dlg.DoModal();
  518. }
  519. BOOL HireDress::CheckEarlyWarning()
  520. {
  521. if(!CheckDateOK(m_date1))return 1;
  522. if(m_date1.IsEmpty () || m_no.IsEmpty () || m_count.IsEmpty ())
  523. {
  524. AfxMessageBox("取件日期和编号和数量为必填项目!");
  525. return 1;
  526. }
  527. if(m_bIsSale==0)
  528. {
  529. if(!CheckDateOK(m_date2))return 1;
  530. if(m_date2.IsEmpty ())
  531. {
  532. AfxMessageBox("取件日期和编号和数量为必填项目!");
  533. return 1;
  534. }
  535. }
  536. int pos=m_comboname.GetCurSel ();
  537. if(pos==-1)return 1;
  538. CString name;
  539. m_comboname.GetLBText (pos, name);
  540. ShowEarlyWarning dlg;
  541. dlg.m_mode=1;
  542. dlg.m_no=m_no;
  543. dlg.m_name=name;
  544. dlg.m_cot1=m_balance;
  545. dlg.m_cot2=m_sellcot;
  546. dlg.m_cot3=m_count;
  547. dlg.m_date1=m_date1;
  548. if(m_bIsSale==0)dlg.m_date2=m_date2;
  549. dlg.DoModal();
  550. return dlg.m_nRet;
  551. }
  552. //库存不足