HireDress.cpp 16 KB

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