LiFan
2024-10-09 edd201eb3a43fdfdae2f278ce9e213181ffeb753
jrj/project/business/QuoteFile.cpp
@@ -3445,6 +3445,10 @@
         //if(makeMessage(L"/task/quote/purchar/backtosaler")==-1) return 1;
         return OnSaleBack();
      }
      else if (comdid == L"xmPurch2")
      {
         return OnPurch2();
      }
      else if (comdid == L"xmPurch")
      {
         return OnPurch();
@@ -3554,10 +3558,10 @@
         if (action == L"purch")
         {
            int crow = dw_cell.GetRow();
            xstring cmd = comdid.mid(3, comdid.length());
            if (getRowID(dw_cell, crow) == L"") SendCtrlCmd(dw_cell, cmd);
            if (getRowID(dw_cell, crow) == L"") SendCtrlCmd(dw_cell, comdid);
            return 1;
         }
         return 1;
      }
      return 0;
   }
@@ -3588,6 +3592,19 @@
         xstring error = x.text();
         alert(error);
         return -1;
      }
      return 1;
   }
   int OnPurch2()
   {
      xaserverarg arg;
      arg.AddArg(L"EntityID", entityID);
      OpenWindow(L"dev:xpage[QuoteFilePurch2Select.vx]", arg);
      xstring taskID = arg.GetArgString(L"TaskID");
      if (taskID != L"")
      {
         ProcessSendMessage(L"/task/quote/repurch", taskID, L"", L"", true);
      }
      return 1;
   }
@@ -4723,6 +4740,21 @@
      return 1;
   }
   xstring GetTryFirstAttr(xstring str, xstring term)
   {
      xstring foundStr = L" " + term + L"=";
      wchar quote = L'"';
      int pos = str.find(foundStr);
      if (pos < 0) return L"";
      pos += foundStr.length();
      while (str.at(pos) == L' ')pos++;
      if (str.at(pos) == L'\'')quote = L'\'';
      int epos = ++pos;
      while (str.at(epos) && str.at(epos) != quote)epos++;
      if (!str.at(epos))return L"";
      return str.mid(pos, epos - pos);
   }
   int onload()
   {
      SetArg();
@@ -4754,7 +4786,11 @@
         x.loadXML(templ);
         */
         action = L"purch";
         action = GetTryFirstAttr(templ, L"action");
         if (action == L"") action = L"purch";
         entityItemID = GetTryFirstAttr(templ, L"TemplateItemID");
         if (entityItemID == L"")entityItemID = GetTryFirstAttr(templ, L"ItemID");
#if 0
         if (templ.find(L"action=\"") >= 0)
         {
            action = templ.mid(templ.find(L"action=\"") + 8, templ.find(L"\"", templ.find(L"action=\"") + 8) - (templ.find(L"action=\"") + 8));
@@ -4771,7 +4807,7 @@
               entityItemID = templ.mid(templ.find(L" ItemID=\"") + 9, templ.find(L"\"", templ.find(L" ItemID=\"") + 9) - (templ.find(L" ItemID=\"") + 9));
            }
         }
#endif
         /*action = x.documentElement.getAttribute(L"action");
         if(action==L"") action=L"purch";
         entityItemID = x.documentElement.getAttribute(L"TemplateItemID");