xj qian
2024-06-27 8c33d0b44a5407d6bd40df767968ce3c49cb60d5
jrj/project/business/quote.enquiry.cpp
@@ -3,6 +3,9 @@
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/ximageview.hpp>
#include <xcontrol/xcell.hpp>
#include <adt/xarray.hpp>
#include <win32/xfile.hpp>
#include <wobject/xdouble.hpp>
#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
@@ -1053,7 +1056,7 @@
         itemStr += L"<ItemName>" + dw_cell.GetItemString(row, colItemName) + L"</ItemName>";
         itemStr += L"<ItemCName>" + dw_cell.GetItemString(row, colItemCName) + L"</ItemCName>";
         itemStr += L"<ItemSpec>" + dw_cell.GetItemString(row, colItemSpec) + L"</ItemSpec>";
         itemStr += L"<RowNo>" + (row - startRow + 1).toString() + L"</RowNo>";
         itemStr += L"<RowNo>" + xstring(row - startRow + 1) + L"</RowNo>";
         itemStr += L"<Purchor>" + dw_cell.GetItemString(row, colBuyer) + L"</Purchor>";
         itemStr += L"<Package>" + dw_cell.GetItemString(row, colPackage) + L"</Package>";
         itemStr += L"<NWT>" + dw_cell.GetItemString(row, colNW) + L"</NWT>";
@@ -1327,18 +1330,17 @@
      arg4.setNativePointer(xaserverarg::CreateInstance());
      trace(items);
      arg4.AddArg(L"value", items);
      OpenWindow(L"dev:xpage[QuoteFilePurched.vx]", cast(arg4 as int));
      OpenWindow(L"dev:xpage[QuoteFilePurched.vx]", arg4);
      if (arg4.GetArgString(L"process") != L"ok") return 1;
      items = arg4.GetArgString(L"value");
      xml x0 ;
      x0.setNativePointer(xml::CreateInstance());
      x0.loadXML(items);
      KXMLDOMNodeList ts = x0.selectNodes(L"data/Item[IsSend='1']");
      int len = ts.length();
      if (len < 1) return L"";
      if (len < 1) return 0;
      xstring content = L"";
      xstring sdate = publiccode::GetCurrentDate();
@@ -1471,7 +1473,7 @@
      {
         trace(L"\r\ntaskid:" + taskid + L" finished:" + finished);
         ProcessSendMessage(myurl, L"", content, datacontent, true);
         win32::PostMessage(GetFrameWindow().GetHWND(), 0x401, L"xmRefreshTask", 0);
         PostMessage(GetFrameWindow().GetHWND(), 0x401, (WPARAM)L"xmRefreshTask", 0);
      }
      return 1;
@@ -1534,7 +1536,7 @@
      arg4.setNativePointer(xaserverarg::CreateInstance());
      trace(items);
      arg4.AddArg(L"value", items);
      OpenWindow(L"dev:xpage[QuoteFilePurch.vx]", cast(arg4 as int));
      OpenWindow(L"dev:xpage[QuoteFilePurch.vx]", arg4);
      if (arg4.GetArgString(L"process") != L"ok") return 1;
      items = arg4.GetArgString(L"value");
@@ -1630,14 +1632,12 @@
      xstring items = GetPurchItems();
      xaserverarg arg4 ;
      arg4.setNativePointer(xaserverarg::CreateInstance());
      arg4.AddArg(L"value", items);
      OpenWindow(L"dev:xpage[QuoteFilePurch.vx]", cast(arg4 as int));
      OpenWindow(L"dev:xpage[QuoteFilePurch.vx]", arg4);
      if (arg4.GetArgString(L"process") != L"ok") return 1;
      items = arg4.GetArgString(L"value");
      xml x0 ;
      x0.setNativePointer(xml::CreateInstance());
      x0.loadXML(items);
      KXMLDOMNodeList ts1 = x0.selectNodes(L"data/Item");
      int len1 = ts1.length();
@@ -1780,6 +1780,7 @@
         }
      }
      int purchercol1 = 0;
      //update purch
      if (1 == 0)
      {
@@ -1810,8 +1811,9 @@
         headrow1 = row2;
         startrow1 = headrow1 + 1;
         int purchercol1 = getItemCol(cell1, headrow1, L"采购人员");
         purchercol1 = getItemCol(cell1, headrow1, L"采购人员");
      }
      //Clear
      if (1 == 1)
@@ -1833,7 +1835,7 @@
            supplier = dw_cell.GetItemString(lastrow, purchercol);
            if (supplier != username)
            {
               KXMLDOMNode n1 = x0.selectSingleNode(L"data/Item[IsSend='1' and Purchor='" + supplier + L"' and RowNo='" + (lastrow - row + 1).toString() + L"']");
               KXMLDOMNode n1 = x0.selectSingleNode(L"data/Item[IsSend='1' and Purchor='" + supplier + L"' and RowNo='" + xstring(lastrow - row + 1) + L"']");
               if (n1)
               {
                  xstring rowid = getRowID(dw_cell, lastrow);
@@ -2028,7 +2030,7 @@
      arg4.setNativePointer(xaserverarg::CreateInstance());
      trace(items);
      arg4.AddArg(L"value", items);
      OpenWindow(L"dev:xpage[QuoteFilePurch.vx]", cast(arg4 as int));
      OpenWindow(L"dev:xpage[QuoteFilePurch.vx]", arg4);
      if (arg4.GetArgString(L"process") != L"ok") return 1;
      items = arg4.GetArgString(L"value");
@@ -2055,7 +2057,6 @@
      }
      xml x0 ;
      x0.setNativePointer(xml::CreateInstance());
      x0.loadXML(items);
      while (supplier != L"")
@@ -2200,7 +2201,7 @@
      xml x = ViewObject::RetrieveData(L"/sale/data/TO/template/param", L"TemplateID", id);
      xml sheet ;
      sheet.loadXML(x.selectSingleNode(L"data/*").xml);
      sheet.loadXML(x.selectSingleNode(L"data/*").xml());
      dw_cell.LoadTemplate(sheet);
      dw_cell.Redraw();
@@ -2319,7 +2320,7 @@
         return L"";
      }
      xstring appPath = GetModuleTmpPath();
      xstring appPath = xutil::GetModuleTmpPath();
      xaserver::CreateDirectory(appPath);
      ret = xaserver::DownLoadFile(GetServerUrl(), L"/business/products/chanpin/" + str + L"/" + name, name, appPath + L"/" + name);
      if (ret < 0)
@@ -2559,7 +2560,7 @@
      dw_cell.SetCellProps(row, colPhoto, props);
      dw_cell.SetCellProps(row, colPhoto1, props);
      xstring appPath = GetModuleTmpPath();
      xstring appPath = xutil::GetModuleTmpPath();
      xstring guid = ViewObject::GetGuid();
      xstring filename1 = UploadImage(guid);
      if (filename1 != L"")
@@ -2586,7 +2587,7 @@
      return 1;
   }
   int GetOpenFileNames(StringArray items, xstring initFileName, xstring filter, xstring ext)
   int GetOpenFileNames(xarray<xstring>& items, xstring initFileName, xstring filter, xstring ext)
   {
      //xstring path = GetOpenFileName(L"",
      //      "JPEG 文件(*.jpg)\0*.jpg;*.jpeg;*.png;*.gif;*.bmp\0全部文件(*.*)\0*.*\0",
@@ -2636,7 +2637,7 @@
      ofn.nFileExtension = 0;
      //debugbreak();
      if (file::GetOpenFileName(ofn))
      if (xfile::GetOpenFileName(ofn))
      {
         int pos = ofn.nFileOffset & 0xffff;
         xstring path = szPath;
@@ -2646,22 +2647,18 @@
         }
         else
         {
            int start = cast(szPath as int);
            wchar_t* start = szPath;
            start += pos * 2;
            xstring str = cast(start  as xstring);
            xstring str = start;
            while (true)
            {
               if (str == L"")break;
               items.push_back(path + L"/" + str);
               start += (str.length() + 1) * 2;
               str = cast(start  as xstring);
               str = start;
            }
         }
      }
      delete szFileName;
      delete szPath;
      delete ofn;
      return items.length();
   }
@@ -2678,12 +2675,11 @@
      int LastRow = dw_cell.GetValidRow();
      if (row < startRow) return  0;
      xstring appPath = GetModuleTmpPath();
      StringArray items;
      items = StringArray::make();
      xstring appPath = xutil::GetModuleTmpPath();
      xarray<xstring> items;
      GetOpenFileNames(items, L"",
         "JPEG 文件(*.jpg)\0*.jpg;*.jpeg;*.png;*.gif;*.bmp\0全部文件(*.*)\0*.*\0",
         "jpg");
         L"JPEG 文件(*.jpg)\0*.jpg;*.jpeg;*.png;*.gif;*.bmp\0全部文件(*.*)\0*.*\0",
         L"jpg");
      if (items.length() < 1) return 1;
      int sRow = row;
@@ -2756,12 +2752,11 @@
      dw_cell.SetCellProps(row, colPhoto, props);
      dw_cell.SetCellProps(row, colPhoto1, props);
      xstring appPath = GetModuleTmpPath();
      StringArray items;
      items = StringArray::make();
      xstring appPath = xutil::GetModuleTmpPath();
      xarray<xstring> items;
      GetOpenFileNames(items, L"",
         L"JPEG 文件(*.jpg)\0*.jpg;*.jpeg;*.png;*.gif;*.bmp\0全部文件(*.*)\0*.*\0",
         "jpg");
         L"jpg");
      if (items.length() < 1) return 1;
      for (int i = 0; i < items.length(); i++)
@@ -2857,7 +2852,7 @@
         double colFOBPriceEx = fobprice.toDouble();
         double colFOBPriceS;
         colFOBPriceS = colFOBPriceEx.round(2);
         colFOBPriceS = xdouble(colFOBPriceEx).round(2);
         xstring colFOBPriceS1 = xstring(colFOBPriceS);
         xstring colFOBPriceS2 = colFOBPriceS1.left(colFOBPriceS1.find(L"."));
         xstring colFOBPriceS3 = colFOBPriceS1.mid(colFOBPriceS1.find(L"."), colFOBPriceS1.length());
@@ -2875,7 +2870,7 @@
            xaserverarg argx ;
            argx.setNativePointer(argx.CreateInstance());
            argx.AddArg(L"GoodsNo", dw_cell.GetItemString(row, colItemNo));
            OpenWindow(L"dev:xpage[CustomerItemNoList.vx]", cast(argx as int));
            OpenWindow(L"dev:xpage[CustomerItemNoList.vx]", argx);
            if (argx.GetArgString(L"action") != L"ok") return 1;
            xml x1 ;
@@ -2919,7 +2914,10 @@
                     dw_cell.SetItemString(row, colQtyPerPack, str2 + L"/" + str1);
                  }
                  else
                  {
                     xstring str1 = goods.selectSingleNode(L"//PackingRate[1]").text();
                     dw_cell.SetItemString(row, colQtyPerPack, str1);
                  }
               }
               ProcessItemImage(dw_cell.GetItemString(row, colSKUNo), row);
               //ProcessItemImage1(dw_cell.GetItemString(row,colItemNo),row);
@@ -2973,7 +2971,7 @@
            //if(qty2 !=L"") qty = qty*qty2.toDouble();
            qty = qty2.toDouble();
            double ttl = 65.0 * qty / v;
            dw_cell.SetItemString(row, col40HQ, ttl.toInt().toString());
            dw_cell.SetItemString(row, col40HQ, xstring((int)ttl));
         }
      }
@@ -3464,7 +3462,7 @@
      }
      else if (comdid == L"xmRefreshTask1")
      {
         win32::PostMessage(GetFrameWindow().GetHWND(), 0x401, L"xmRefreshTask", 0);
         PostMessage(GetFrameWindow().GetHWND(), 0x401, L"xmRefreshTask", 0);
         return 1;
      }
      else if (comdid == L"xmFileOpen" || comdid == L"xmOpen" || comdid == L"xmNew")
@@ -3513,7 +3511,7 @@
            dw_cell.Redraw();
            filename = args.GetArgString(L"filename");
            fileid = args.GetArgString(L"ID");
            win32::SetWindowText(GetHWND(), L"报价文件:" + filename);
            SetWindowText(GetHWND(), L"报价文件:" + filename);
         }
         return 1;
      }
@@ -3523,7 +3521,7 @@
         dw_cell.Redraw();
         filename = L"";
         fileid = L"";
         win32::SetWindowText(GetHWND(), L"报价文件:[new]");
         SetWindowText(GetHWND(), L"报价文件:[new]");
         return 1;
      }
      else if (comdid == L"xmFileSave" || comdid == L"xmSave")
@@ -4540,7 +4538,7 @@
      xstring sh = doc.GetXml();
      int p = cast(sh as int);
      win32::SendMessage(m_winHwnd, 0x401, p, 0);
      SendMessage(m_winHwnd, 0x401, p, 0);
      */
      return 1;
   }
@@ -4797,7 +4795,7 @@
         dw_cell.openUrl(templateurl);
         */
         //win32::SetWindowText(GetHWND(),L"报价文件:[new]");
         //SetWindowText(GetHWND(),L"报价文件:[new]");
      }
      ARow = 0;