LiFan
昨天 d4726c427464d5fa50c9fce848831c4cec36d8d1
jrj/project/business/BasicCode/ForwarderMaint.cpp
@@ -3,12 +3,14 @@
#include <xcontrol/xdwgrid.hpp>
#include <wobject/xdouble.hpp>
#include <xcontrol/xlayersheet.hpp>
#include <xcontrol/xcell.hpp>
#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
#include "vbusiness/vframe/maint.vframe.vbusiness.hpp"
#include "viewobject/view.base.hpp"
using xml = KXMLDOMDocument;
class __declspec(dllexport) ForwarderMaint : public xframe
class __declspec(dllexport) ForwarderMaint : public maint
{
public:
   KXMLDOMDocument m_configDoc;
@@ -20,25 +22,18 @@
   xcell dw_cell;
   xstring m_EntityID = L"";
public:
   ForwarderMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
   ForwarderMaint(void* implPtr, HWND hWnd) :maint(implPtr, hWnd) {}
public:
   static ForwarderMaint* CreateInstance(void* implPtr, void* hWnd)
   {
      ForwarderMaint* pWin = new ForwarderMaint(implPtr, (HWND)hWnd);
      return pWin;
   }
   int alert(xstring str)
   {
      //win::MessageBox(GetHWND(),str,L"提示22:",0);
      TApp::alert(this, str);
      return 0;
   }
   int setCellReadOnly()
   {
      dw_base = new xdwtable;
      dw_base.setNativePointer(GetControl(L"dw_base"));
      dw_cell = new xcell;
      dw_cell.setNativePointer(dw_base.QueryItem(L"ixcell"));
      dw_base =GetControl(L"dw_base");
      dw_cell = dw_base.QueryItem(L"ixcell");
      xstring strnew = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''/>";
      //dw_cell.SetCellProps(2,2,strnew);         
      return 0;
@@ -49,11 +44,9 @@
   }
   int OnClear() {
      if (m_EntityID == L"") {
         trace(1);
         m_userid = publiccode::GetUser().id;
         m_userid = publiccode::GetUser().personid;
         m_username = publiccode::GetUser().name;
         dw_base = new xdwtable;
         dw_base.setNativePointer(GetControl(L"dw_base"));
         dw_base = GetControl(L"dw_base");
         dw_base.SetItemString(1, L"ForwarderID", GetGuid());
         dw_base.SetItemString(1, L"PartyID", GetGuid());
         dw_base.SetItemString(1, L"PStatus", L"1");
@@ -87,7 +80,7 @@
         dw_base.SetItemString(1, L"ForwarderType", L"1");
         dw_base.SetItemDisplayString(1, L"ForwarderType", L"预付货");
         //dw_base.SetItemString(1,L"PrimaryContactID",dwcon.GetItemString(1,L"ContactID"));   
         return 0;
      }
      else
      {
@@ -98,10 +91,8 @@
   int OnAddrow()
   {
      dw_base = new xdwtable;
      dw_base.setNativePointer(GetControl(L"dw_base"));
      xdwtable dw = new xdwtable;
      dw.setNativePointer(dw_base.GetCurTable());
      dw_base = GetControl(L"dw_base");
      xdwtable dw = dw_base.GetCurTable();
      xstring dw_n = dw.GetDwName();
      if (dw_n == L"item")
      {
@@ -113,10 +104,8 @@
   }
   int OnInsertRow()
   {
      dw_base = new xdwtable;
      dw_base.setNativePointer(GetControl(L"dw_base"));
      xdwtable dw = new xdwtable;
      dw.setNativePointer(dw_base.GetCurTable());
      dw_base = GetControl(L"dw_base");
      xdwtable dw = dw_base.GetCurTable();
      xstring dw_n = dw.GetDwName();
      if (dw_n == L"item")
      {
@@ -132,8 +121,7 @@
   {
      dw_base = new xdwtable;
      dw_base.setNativePointer(GetControl(L"dw_base"));
      xdwtable dw = new xdwtable;
      dw.setNativePointer(dw_base.GetCurTable());
      xdwtable dw = dw_base.GetCurTable();
      xstring dw_n = dw.GetDwName();
      if (dw_n == L"item")
      {
@@ -183,15 +171,13 @@
   int OnPreSave()
   {
      dw_base.AcceptText();
      dw_base = new xdwtable;
      dw_base.setNativePointer(GetControl(L"dw_base"));
      dw_base = GetControl(L"dw_base");
      xstring ForwarderNo = dw_base.GetItemString(1, L"ForwarderNo");
      if (ForwarderNo == L"")
      {
         dw_base.SetItemString(1, L"ForwarderNo", getGoodsNo());
      }
      xdwtable dwcon = new xdwtable;
      dwcon.setNativePointer(dw_base.FindDwTable(L"item", 0));
      xdwtable dwcon =dw_base.FindDwTable(L"item", 0);
      int i;
      for (i = 1; i <= dwcon.GetRowCount(); i++)
      {
@@ -218,8 +204,7 @@
            }
         }
      }
      xdwtable dwcon2 = new xdwtable;
      dwcon2.setNativePointer(dw_base.FindDwTable(L"item2", 0));
      xdwtable dwcon2 = dw_base.FindDwTable(L"item2", 0);
      int k;
      xstring sPBABankName2 = L"";
      xstring sPBABankAccountNo2 = L"";
@@ -252,8 +237,7 @@
            }
         }
      }
      xdwtable  dwcon1 = new xdwtable;
      dwcon1.setNativePointer(dw_base.FindDwTable(L"item1", 0));
      xdwtable  dwcon1 = dw_base.FindDwTable(L"item1", 0);
      int j;
      xstring sPBABankName1 = L"";
      xstring sPBABankAccountNo1 = L"";
@@ -288,8 +272,7 @@
   }
   int OnPostSave()
   {
      dw_base = new xdwtable;
      dw_base.setNativePointer(GetControl(L"dw_base"));
      dw_base = GetControl(L"dw_base");
      xaserverarg args;
      xml x;
@@ -300,8 +283,8 @@
      //主联系人
      xstring spGuid;
      KXMLDOMElement e;
      var list = x.selectNodes(L"//item");
      int nlen = list.length;
      auto list = x.selectNodes(L"//item");
      int nlen = list.length();
      int i;
      for (i = 0; i < nlen; i++)
      {
@@ -336,8 +319,7 @@
   }
   int OnSave()
   {
      dw_base = new xdwtable;
      dw_base.setNativePointer(GetControl(L"dw_base"));
      dw_base = GetControl(L"dw_base");
      xstring SName = dw_base.GetItemString(1, L"Name");
      if (SName == L"") {
         alert(L"请输入货代名称!");
@@ -400,8 +382,7 @@
   }
   int OnCellChanged(TEvent* evt, LPARAM p)
   {
      dw_base = new xdwtable;
      dw_base.setNativePointer(GetControl(L"dw_base"));
      dw_base = GetControl(L"dw_base");
      DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
      xstring colname = hdr.colname;
      xstring coldata = hdr.data;
@@ -430,8 +411,7 @@
      else if (colname == L"PPrimaryFlag" && coldata == L"Y")
      {
         xdwtable dw_pc;
         dw_pc = new xdwtable;
         dw_pc.setNativePointer(dw_base.FindDwTable(L"item"));
         dw_pc = dw_base.FindDwTable(L"item");
         if (dw_pc)
         {
            int i;
@@ -453,8 +433,9 @@
   }
   int onload()
   {
      dw_base = new xdwtable;
      dw_base.setNativePointer(GetControl(L"dw_base"));
      SetArg();
      dw_base = GetControl(L"dw_base");
      OnAttachEvent();
      //if(!m_configDoc) return -1;
@@ -462,6 +443,12 @@
      maint::onload();
      OnClear();
      return 1;
   }
   int onloaded()
   {
      return maint::onloaded();
   }
};