|  |  | 
 |  |  |       xdwgrid   dwc_list; | 
 |  |  |  | 
 |  |  |       //产品缓存对象 | 
 |  |  |       xdataset g_xdoc_product; | 
 |  |  |       xdataset g_xdoc_shoppingcart; | 
 |  |  |       //xdataset dw_list; | 
 |  |  |       //xdataset dwc_list; | 
 |  |  |  | 
 |  |  |       xcombobox  cbx_goodscar; | 
 |  |  |       //是否多选 | 
 |  |  | 
 |  |  |          { | 
 |  |  |             KXMLDOMElement e = nlist.item(i); | 
 |  |  |             xstring name = e.getAttribute(L"name"); | 
 |  |  |             xcombobox::AddItem(xc.GetId(), name); | 
 |  |  |             xcombobox::AddItem(xc.GetHWND(), name); | 
 |  |  |          } | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  | 
 |  |  |       KXMLDOMElement OnGetCarListRowElement(int row = 0) | 
 |  |  |       { | 
 |  |  |          if (row < 1) row = dwc_list.GetRow(); | 
 |  |  |          if (row < 1 || row > dwc_list.GetRowCount()) return 0; | 
 |  |  |          KXMLDOMElement e = g_xdoc_shoppingcart.getRowElement(L"data/Item", row); | 
 |  |  |          if (row < 1 || row > dwc_list.GetRowCount()) return KXMLDOMElement(); | 
 |  |  |          KXMLDOMElement e = dwc_list.GetRowElement(row); | 
 |  |  |          return e; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  | 
 |  |  |          xml xp ; | 
 |  |  |           | 
 |  |  |          xaserverarg arg_pic; | 
 |  |  |          arg_pic.setNativePointer(arg_pic.CreateInstance()); | 
 |  |  | 			 | 
 |  |  |          arg_pic.AddArg(L"SKUID", skuid); | 
 |  |  |          if (xurl::get(L"/sale/data/ProductLibrary3/pref/picture/imagelistSKU", arg_pic.GetString(), xp) != 1) | 
 |  |  |          { | 
 |  |  | 
 |  |  |          xml xp ; | 
 |  |  |           | 
 |  |  |          xaserverarg arg_pic; | 
 |  |  |          arg_pic.setNativePointer(arg_pic.CreateInstance()); | 
 |  |  | 			 | 
 |  |  |          arg_pic.AddArg(L"SKUID", skuid); | 
 |  |  |          arg_pic.AddArg(L"CustomerID", m_customer); | 
 |  |  |          arg_pic.AddArg(L"CustomerItemNo", customerItemNo); | 
 |  |  | 
 |  |  |          xs.SetContent(html); | 
 |  |  |          xs.Redraw(); | 
 |  |  |  | 
 |  |  |          xstring id = g_xdoc_product.getData(0, L"data/Item", row, L"@guid"); | 
 |  |  |          xstring id = dw_list.GetItemString(row, L"@guid"); | 
 |  |  |          OnShowImage(id); | 
 |  |  |  | 
 |  |  |          return 1; | 
 |  |  | 
 |  |  |          xstring html = makeGoodscarHtml(row); | 
 |  |  |          xs.SetContent(html); | 
 |  |  |          xs.Redraw(); | 
 |  |  |          xstring id = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SKUID"); | 
 |  |  |          xstring id = dwc_list.GetItemString(row, L"SKUID"); | 
 |  |  |          if (m_customer != L"") | 
 |  |  |          { | 
 |  |  |             xstring customerItemNo = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"CustomerItemNo"); | 
 |  |  |             xstring customerItemNo = dwc_list.GetItemString(row, L"CustomerItemNo"); | 
 |  |  |             OnShowImage(id, customerItemNo); | 
 |  |  |          } | 
 |  |  |          else | 
 |  |  | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  | #if 0 | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |       int DeleteRow(int row) | 
 |  |  |       { | 
 |  |  |          int IDOK = 1; | 
 |  |  |          int MB_OKCANCEL = 1; | 
 |  |  |          int MB_ICONQUESTION = 32; | 
 |  |  |          if (MessageBox(GetHWND(), L"确认删除指定的项,删除后将不能恢复?", L"提示", MB_OKCANCEL | MB_ICONQUESTION) != IDOK) return 1; | 
 |  |  |          xstring id = g_xdoc_product.getData(0, L"data/Item", row, L"@guid"); | 
 |  |  |          xstring id = dw_list.GetItemString(row, L"@guid"); | 
 |  |  |  | 
 |  |  |          if (ProductLibraryView::DeleteItem(id) == 1)   dw_list.DeleteRow(0); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  | #endif // 0 | 
 |  |  |       int SetSelectState(xdwgrid dw_obj, int state) | 
 |  |  |       { | 
 |  |  |          dw_obj.SetSelectionMode(3); | 
 |  |  | 
 |  |  |          if (row < 1) row = dw_list.GetRow(); | 
 |  |  |          if (row < 1 || row > dw_list.GetRowCount()) return 0; | 
 |  |  |  | 
 |  |  |          KXMLDOMElement e = g_xdoc_product.getRowElement(L"data/Item", row); | 
 |  |  |          xstring skuid = g_xdoc_product.getData(0, L"data/Item", row, L"@guid"); | 
 |  |  |          xstring SKUNo = g_xdoc_product.getData(0, L"data/Item", row, L"SKUNo"); | 
 |  |  |          KXMLDOMElement e = dw_list.GetRowElement(row); | 
 |  |  |          xstring skuid = dw_list.GetItemString(row, L"@guid"); | 
 |  |  |          xstring SKUNo = dw_list.GetItemString(row, L"SKUNo"); | 
 |  |  |          xstring id = ViewObject::GetGuid(); | 
 |  |  |          xstring ret1 = Up(id); | 
 |  |  |          if (ret1 == L"-1") return -1; | 
 |  |  | 
 |  |  |          xaserverarg arg; | 
 |  |  |           | 
 |  |  |          arg.AddArg(L"content", x.xml()); | 
 |  |  |          //alert(x.xml()); | 
 |  |  |          if (xurl::get(L"/sale/data/ProductLibrary/image/update", arg.GetString(), x) != 1) | 
 |  |  |          { | 
 |  |  |             alert(x.text()); | 
 |  |  | 
 |  |  |          if (row < 1) row = dwc_list.GetRow(); | 
 |  |  |          if (row < 1 || row > dwc_list.GetRowCount()) return 0; | 
 |  |  |  | 
 |  |  |          KXMLDOMElement e = g_xdoc_shoppingcart.getRowElement(L"data/Item", row); | 
 |  |  |          xstring skuid = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SKUID"); | 
 |  |  |          xstring SKUNo = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SKUID/@__displaystring"); | 
 |  |  |          KXMLDOMElement e = dwc_list.GetRowElement(row); | 
 |  |  |          xstring skuid = dwc_list.GetItemString(row, L"SKUID"); | 
 |  |  |          xstring SKUNo = dwc_list.GetItemString(row, L"SKUID/@__displaystring"); | 
 |  |  |          CustomerID = m_customer; | 
 |  |  |          xstring CustomerItemNo = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"CustomerItemNo"); | 
 |  |  |          xstring CustomerItemNo = dwc_list.GetItemString(row, L"CustomerItemNo"); | 
 |  |  |          xstring id = ViewObject::GetGuid(); | 
 |  |  |          xstring ret1 = Up(id); | 
 |  |  |          if (ret1 == L"-1") return -1; | 
 |  |  | 
 |  |  |             dwc_list.Redraw(); | 
 |  |  |          } | 
 |  |  |  | 
 |  |  |          xstring skuid = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SKUID"); | 
 |  |  |          xstring SKUNo = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SKUID/@__displaystring"); | 
 |  |  |          xstring skuid = dwc_list.GetItemString(row, L"SKUID"); | 
 |  |  |          xstring SKUNo = dwc_list.GetItemString(row, L"SKUID/@__displaystring"); | 
 |  |  |          CustomerID = m_customer; | 
 |  |  |          xstring CustomerItemNo = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"CustomerItemNo"); | 
 |  |  |          xstring CustomerItemNo = dwc_list.GetItemString(row, L"CustomerItemNo"); | 
 |  |  |          OnShowImage(skuid, CustomerItemNo); | 
 |  |  |  | 
 |  |  |          return 1; | 
 |  |  | 
 |  |  |             dw_list.Redraw(); | 
 |  |  |          } | 
 |  |  |  | 
 |  |  |          KXMLDOMElement e1 = g_xdoc_product.getRowElement(L"data/Item", row); | 
 |  |  |          KXMLDOMElement e1 = dw_list.GetRowElement(row); | 
 |  |  |          xstring skuid = e1.getAttribute(L"guid"); | 
 |  |  |          OnShowImage(skuid); | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |       xstring makeHtml(int row) | 
 |  |  |       { | 
 |  |  |          xstring id = g_xdoc_product.getData(0, L"data/Item", row, L"@guid"); | 
 |  |  |          xstring id = dw_list.GetItemString(row, L"@guid"); | 
 |  |  |          xml x = GetGoodsPropList(id); | 
 |  |  |          xml x1 = GetGoodsPropListEx(id); | 
 |  |  |  | 
 |  |  | 
 |  |  |             { | 
 |  |  |                name = fieldsEx.item(i).selectSingleNode(L"@name").text(); | 
 |  |  |                label = fieldsEx.item(i).selectSingleNode(L"@label").text(); | 
 |  |  |                ls_item += L"<td>" + label + L"</td>" + L"<td style='text-align:center'>" + g_xdoc_product.getData(0, L"data/Item", row, name) + L"</td>"; | 
 |  |  |                ls_item += L"<td>" + label + L"</td>" + L"<td style='text-align:center'>" + dw_list.GetItemString(row, name) + L"</td>"; | 
 |  |  |                cnt++; | 
 |  |  |                i++; | 
 |  |  |                if (i == len)break; | 
 |  |  | 
 |  |  |                   if (i >= len)count = 2; | 
 |  |  |                   continue; | 
 |  |  |                } | 
 |  |  |                else if (g_xdoc_product.getData(0, L"data/Item", row, name) == L"") | 
 |  |  |                else if (dw_list.GetItemString(row, name) == L"") | 
 |  |  |                { | 
 |  |  |                   KXMLDOMNodeList options = fields.item(i).selectNodes(L"item"); | 
 |  |  |                   int tlen = options.length(); | 
 |  |  | 
 |  |  |                } | 
 |  |  |                else | 
 |  |  |                { | 
 |  |  |                   ls_item = L"<td>" + label + L"</td>" + L"<td>" + g_xdoc_product.getData(0, L"data/Item", row, name) + L"</td>"; | 
 |  |  |                   ls_item = L"<td>" + label + L"</td>" + L"<td>" + dw_list.GetItemString(row, name) + L"</td>"; | 
 |  |  |                   count++; | 
 |  |  |                } | 
 |  |  |                i++; | 
 |  |  | 
 |  |  |             html += L"<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + dw_list.GetItemString(row, L"PackTerm") + L"</span></div>"; | 
 |  |  |          } | 
 |  |  |  | 
 |  |  |          if (g_xdoc_product.getData(0, L"data/Item", row, L"Remark") != L"" && id == L"23A8BBA2-DEF1-4C00-978E-646151A6082E") | 
 |  |  |          if (dw_list.GetItemString(row, L"Remark") != L"" && id == L"23A8BBA2-DEF1-4C00-978E-646151A6082E") | 
 |  |  |          { | 
 |  |  |             html += L"<div ><span style='font-weight:700;width:50;font-size:10pt'  >备注:</span></div>"; | 
 |  |  |             html += L"<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + g_xdoc_product.getData(0, L"data/Item", row, L"Remark") + L"</span></div>"; | 
 |  |  |             html += L"<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + dw_list.GetItemString(row, L"Remark") + L"</span></div>"; | 
 |  |  |          } | 
 |  |  |  | 
 |  |  |          html += L"<div style='height:24px'/>"; | 
 |  |  | 
 |  |  |             if (i == 0) | 
 |  |  |                html += L"<td rowspan='" + xstring(len) + L"'>" + No + L"</td><td >" + label + L"</td><td >" + L"</td>"; | 
 |  |  |             else | 
 |  |  |                html += L"<td >" + label + L"</td><td >" + g_xdoc_shoppingcart.getData(0, L"data/Item", row, name) + L"</td>"; | 
 |  |  |                html += L"<td >" + label + L"</td><td >" + dwc_list.GetItemString(row, name) + L"</td>"; | 
 |  |  |             html += L"</tr>"; | 
 |  |  |          } | 
 |  |  |  | 
 |  |  |          html += L"<tr>"; | 
 |  |  |          html += L"<td rowspan='3'>" + g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"PackCode") + L"</td><td >包装方式</td><td >" + | 
 |  |  |             g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"CPack") + L"</td>"; | 
 |  |  |          html += L"<td rowspan='3'>" + dwc_list.GetItemString(row, L"PackCode") + L"</td><td >包装方式</td><td >" + | 
 |  |  |             dwc_list.GetItemString(row, L"CPack") + L"</td>"; | 
 |  |  |          html += L"</tr>"; | 
 |  |  |          html += L"<tr height='48'>"; | 
 |  |  |          html += L"<td >包装要求</td><td >" + g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"PackQualityTerm") + L"</td>"; | 
 |  |  |          html += L"<td >包装要求</td><td >" + dwc_list.GetItemString(row, L"PackQualityTerm") + L"</td>"; | 
 |  |  |          html += L"</tr>"; | 
 |  |  |          html += L"<tr>"; | 
 |  |  |          html += L"<td >侧唛</td><td ></td>"; | 
 |  |  |          html += L"</tr>"; | 
 |  |  |  | 
 |  |  |          html += L"<tr height='72'>"; | 
 |  |  |          html += L"<td>" + g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"QualityCode") + L"</td><td >质量要求</td><td >" + | 
 |  |  |             g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"QualityTerm") + L"</td>"; | 
 |  |  |          html += L"<td>" + dwc_list.GetItemString(row, L"QualityCode") + L"</td><td >质量要求</td><td >" + | 
 |  |  |             dwc_list.GetItemString(row, L"QualityTerm") + L"</td>"; | 
 |  |  |          html += L"</tr>"; | 
 |  |  |  | 
 |  |  |          html += L"</table>"; | 
 |  |  | 
 |  |  |          dw_list.Redraw(); | 
 |  |  |          impStr = L""; | 
 |  |  |  | 
 |  |  |          SendMessage(hObject, 0x401, (LPARAM)ls_nos, 0); | 
 |  |  |          SendMessage(hObject, 0x401, (LPARAM)ls_nos.c_str(), 0); | 
 |  |  |          alert(L"转入完成!"); | 
 |  |  |  | 
 |  |  |          return 1; | 
 |  |  | 
 |  |  |          int MB_OKCANCEL = 1; | 
 |  |  |          int MB_ICONQUESTION = 32; | 
 |  |  |          if (MessageBox(GetHWND(), L"确认删除指定的项,删除后将不能恢复?", L"提示", MB_OKCANCEL | MB_ICONQUESTION) != IDOK) return 1; | 
 |  |  |          xstring id = g_xdoc_product.getData(0, L"data/Item", row, L"@guid"); | 
 |  |  |          xstring id = dw_list.GetItemString(row, L"@guid"); | 
 |  |  |  | 
 |  |  |          if (ProductLibraryView::DeleteItem(id) == 1) dw_list.DeleteRow(0); | 
 |  |  |  | 
 |  |  | 
 |  |  |          HTREEITEM hItem = tv_folder.GetSelectedItem(); | 
 |  |  |          HTREEITEM hTopItem = LookupTopFolder(hItem); | 
 |  |  |          xstring name = tv_folder.GetItemLabel(hTopItem); | 
 |  |  |  | 
 |  |  |          if(name==L"") return 1; | 
 |  |  |          KXMLDOMElement e = tv_folder.GetItemData(hItem); | 
 |  |  |          xstring guid = e.getAttribute(L"guid"); | 
 |  |  |          if (guid == L"") return 1; | 
 |  |  | 
 |  |  |          if (Name == L"") Name = e.getAttribute(L"cname"); | 
 |  |  |          arg.AddArg(L"No", No); | 
 |  |  |          arg.AddArg(L"CName", Name); | 
 |  |  |          int p = arg; | 
 |  |  |          OpenWindow(L"dev:xpage[Quick.Input.NewProductEx.vx]", p); | 
 |  |  | 			 | 
 |  |  |          OpenWindow(L"dev:xpage[Quick.Input.NewProductEx.vx]", arg); | 
 |  |  |          if (arg.GetArgString(L"data.modify") == L"1")RetrieveItem(hItem); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  | 
 |  |  |             OpenWindow(L"dev:xpage[PackSchemaMaint.goodslib.vx]"); | 
 |  |  |          }else | 
 |  |  |          { | 
 |  |  |             int pr = g_xdoc_product; | 
 |  |  |             OpenWindow(L"dev:xpage[ProductLibraryItemMaint.vx]",pr); | 
 |  |  |             OpenWindow(L"dev:xpage[ProductLibraryItemMaint.vx]",dw_list); | 
 |  |  |          } | 
 |  |  |          */ | 
 |  |  |          //KXMLDOMElement ele = g_xdoc_product.getRowElement(L"data/Item", 1); | 
 |  |  |          //KXMLDOMElement ele = dw_list.getRowElement(L"data/Item", 1); | 
 |  |  |          //alert(ele.xml); | 
 |  |  |  | 
 |  |  |          int pr = g_xdoc_product; | 
 |  |  |          OpenWindow(L"dev:xpage[ProductLibraryItemMaint3.vx]", pr); | 
 |  |  |          OpenWindow(L"dev:xpage[ProductLibraryItemMaint3.vx]", dw_list); | 
 |  |  |  | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  | 
 |  |  |          int len = nlist.length(); | 
 |  |  |          for (int i = 0; i < len; i++) | 
 |  |  |          { | 
 |  |  |             KXMLDOMElement& e = *new KXMLDOMElement(nlist.item(i)); | 
 |  |  |             KXMLDOMElement e = nlist.item(i); | 
 |  |  |             xstring name = e.getAttribute(L"CName"); | 
 |  |  |             xstring no = e.getAttribute(L"CategoryNo"); | 
 |  |  |             xstring label = no.trim() + L" " + name; | 
 |  |  |  | 
 |  |  |             HTREEITEM h = tv_folder.InsertChildItem(hItem, label, (LPARAM)&e, 15); | 
 |  |  |             HTREEITEM h = tv_folder.InsertChildItem(hItem, label, e, 15); | 
 |  |  |             xstring child = e.getAttribute(L"Childs"); | 
 |  |  |             if (child == L"") | 
 |  |  |                tv_folder.SetItemChild(h, 1); | 
 |  |  | 
 |  |  |          int len = nlist.length(); | 
 |  |  |          for (int i = 0; i < len; i++) | 
 |  |  |          { | 
 |  |  |             KXMLDOMElement& e = *new KXMLDOMElement(nlist.item(i)); | 
 |  |  |             KXMLDOMElement e = nlist.item(i); | 
 |  |  |             xstring name = e.getAttribute(L"CName"); | 
 |  |  |             xstring no = e.getAttribute(L"CategoryNo"); | 
 |  |  |             xstring label = no.trim() + L" " + name; | 
 |  |  |  | 
 |  |  |             HTREEITEM h = tv_folder.InsertChildItem(hItem, label, (LPARAM)&e, 15); | 
 |  |  |             HTREEITEM h = tv_folder.InsertChildItem(hItem, label, e, 15); | 
 |  |  |             xstring child = e.getAttribute(L"Childs"); | 
 |  |  |             if (child == L"") | 
 |  |  |                tv_folder.SetItemChild(h, 1); | 
 |  |  | 
 |  |  |          if (len > 0) tv_folder.SetItemChild(hItem, 1); | 
 |  |  |          for (int i = 0; i < len; i++) | 
 |  |  |          { | 
 |  |  |             KXMLDOMElement& e = *new KXMLDOMElement(nlist.item(i)); | 
 |  |  |             KXMLDOMElement e = nlist.item(i); | 
 |  |  |             xstring name = e.getAttribute(L"name"); | 
 |  |  |             HTREEITEM h = tv_folder.InsertChildItem(hItem, name, (LPARAM)&e, image); | 
 |  |  |             HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e, image); | 
 |  |  |             ExpandCatChildFolder(h, e, 35); | 
 |  |  |          } | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |       int MakeGoodCarFolderItem(HTREEITEM hItem) | 
 |  |  |       { | 
 |  |  |          xml x = ShoppingCartView::GetRoleList(); | 
 |  |  |          xml x = ShoppingCartView::GetSupplierRoleList(SupplierID); | 
 |  |  |          if (!x) return 0; | 
 |  |  |          KXMLDOMNodeList nlist = x.selectNodes(L"/data/item"); | 
 |  |  |          int len = nlist.length(); | 
 |  |  |          for (int i = 0; i < len; i++) | 
 |  |  |          { | 
 |  |  |             KXMLDOMElement& e = *new KXMLDOMElement(nlist.item(i)); | 
 |  |  |             KXMLDOMElement e = nlist.item(i); | 
 |  |  |             xstring name = e.getAttribute(L"name"); | 
 |  |  |             HTREEITEM h = tv_folder.InsertChildItem(hItem, name, (LPARAM)&e, 35); | 
 |  |  |             HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e, 35); | 
 |  |  |             ExpandCatChildFolder(h, e, 35); | 
 |  |  |          } | 
 |  |  |          return 1; | 
 |  |  | 
 |  |  |       { | 
 |  |  |          while (true) | 
 |  |  |          { | 
 |  |  |             KXMLDOMElement& e1 = *(KXMLDOMElement*)tv_folder.GetItemData(hItem); | 
 |  |  |             KXMLDOMElement e1 = tv_folder.GetItemData(hItem); | 
 |  |  |             xstring str = e1.getAttribute(L"no"); | 
 |  |  |             if (str.find(L"Customer:") >= 0) return hItem; | 
 |  |  |             hItem = tv_folder.GetParentItem(hItem); | 
 |  |  | 
 |  |  |       { | 
 |  |  |          hItem = LookupCustomerFolder(hItem); | 
 |  |  |          if (hItem == 0) return L""; | 
 |  |  |          KXMLDOMElement& e1 = *(KXMLDOMElement*)tv_folder.GetItemData(hItem); | 
 |  |  |          KXMLDOMElement e1 = tv_folder.GetItemData(hItem); | 
 |  |  |          xstring str = e1.getAttribute(L"no"); | 
 |  |  |          return str.mid(xstring(L"Customer:").length(), 9999); | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       HTREEITEM RetrieveItem(HTREEITEM hItem) | 
 |  |  |       int RetrieveItem(HTREEITEM hItem) | 
 |  |  |       { | 
 |  |  |          HTREEITEM hTopItem = LookupTopFolder(hItem); | 
 |  |  |          tname = tv_folder.GetItemLabel(hTopItem); | 
 |  |  | 
 |  |  |             ResetAgent(L"goodscar"); | 
 |  |  |             if (selectname != tname) | 
 |  |  |             { | 
 |  |  |                KXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as KXMLDOMElement); | 
 |  |  |                KXMLDOMElement e1 =tv_folder.GetItemData(hItem); | 
 |  |  |                str = e1.getAttribute(L"no"); | 
 |  |  |                if (str == L"Supplier") return 1; | 
 |  |  |                if (str == L"Supplier") | 
 |  |  |                { | 
 |  |  |                   return 1; | 
 |  |  |                } | 
 |  |  |                if (str.find(L"Customer:") == 0 || str.find(L"SO:") == 0 || str.find(L"Supplier:") == 0 || str.find(L"Enquiry:") == 0) | 
 |  |  |                { | 
 |  |  |                   m_customer = LookupCustomer(hItem); | 
 |  |  | 
 |  |  |                   dwc_list.Reset(); | 
 |  |  |                   dwc_list.SetReadOnly(true); | 
 |  |  |                   if (queryString == L"") | 
 |  |  |                      g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(str)); | 
 |  |  |                      dwc_list.Retrieve(ShoppingCartView::GetGoodsList(str)); | 
 |  |  |                   else | 
 |  |  |                      g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(str, queryString)); | 
 |  |  |                      dwc_list.Retrieve(ShoppingCartView::GetGoodsList(str, queryString)); | 
 |  |  |                   if (str.find(L"Supplier:") == 0) | 
 |  |  |                   { | 
 |  |  |                      if (dwc_list.GetRowCount() > 0) | 
 |  |  | 
 |  |  |                   dwc_list.SetReadOnly(true); | 
 |  |  |                   dwc_list.Reset(); | 
 |  |  |                   if (queryString == L"") | 
 |  |  |                      g_xdoc_shoppingcart.Retrieve(ProductLibraryView::GetMaintList3(categoryid)); | 
 |  |  |                      dwc_list.Retrieve(ProductLibraryView::GetMaintList3(categoryid)); | 
 |  |  |                   else | 
 |  |  |                      g_xdoc_shoppingcart.Retrieve(ProductLibraryView::GetMaintList3(categoryid, queryString, L"")); | 
 |  |  |                      dwc_list.Retrieve(ProductLibraryView::GetMaintList3(categoryid, queryString, L"")); | 
 |  |  |                } | 
 |  |  |                else | 
 |  |  |                { | 
 |  |  | 
 |  |  |                   dwc_list.SetReadOnly(true); | 
 |  |  |                   dwc_list.Reset(); | 
 |  |  |                   if (queryString == L"") | 
 |  |  |                      g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(selectname)); | 
 |  |  |                      dwc_list.Retrieve(ShoppingCartView::GetGoodsList(selectname)); | 
 |  |  |                   else | 
 |  |  |                      g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(selectname, queryString)); | 
 |  |  |                      dwc_list.Retrieve(ShoppingCartView::GetGoodsList(selectname, queryString)); | 
 |  |  |                } | 
 |  |  |                dwc_list.PostRetrieve(); | 
 |  |  |                dwc_list.Redraw(); | 
 |  |  |  | 
 |  |  |                if (dwc_list.GetRowCount() >= 1) | 
 |  |  | 
 |  |  |  | 
 |  |  |                   if (m_customer != L"") | 
 |  |  |                   { | 
 |  |  |                      xstring skuid = g_xdoc_shoppingcart.getData(0, L"data/Item", 1, L"SKUID"); | 
 |  |  |                      xstring customerItemNo = g_xdoc_shoppingcart.getData(0, L"data/Item", 1, L"CustomerItemNo"); | 
 |  |  |                      xstring skuid = dwc_list.GetItemString(1, L"SKUID"); | 
 |  |  |                      xstring customerItemNo = dwc_list.GetItemString(1, L"CustomerItemNo"); | 
 |  |  |                      OnShowImage(skuid, customerItemNo); | 
 |  |  |                   } | 
 |  |  |                } | 
 |  |  | 
 |  |  |                else | 
 |  |  |                { | 
 |  |  |                   str = L"Supplier:All"; | 
 |  |  |                   g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(str, queryString)); | 
 |  |  |                   dwc_list.PostRetrieve(); | 
 |  |  |                   dwc_list.Retrieve(ShoppingCartView::GetGoodsList(str, queryString)); | 
 |  |  |                   //dwc_list.PostRetrieve(); | 
 |  |  |                   dwc_list.Redraw(); | 
 |  |  |                } | 
 |  |  |             } | 
 |  |  | 
 |  |  |                      x = ProductLibraryView::GetMaintList3(no); | 
 |  |  |                   if (x) | 
 |  |  |                   { | 
 |  |  |                      g_xdoc_product.Retrieve(x); | 
 |  |  |                      dw_list.Retrieve(x); | 
 |  |  |                       | 
 |  |  |                   } | 
 |  |  |                } | 
 |  |  | 
 |  |  |                      else | 
 |  |  |                         x = ProductLibraryView::GetMaintList3(no); | 
 |  |  |                   } | 
 |  |  |                   if (x)g_xdoc_product.Retrieve(x); | 
 |  |  |                   if (x)dw_list.Retrieve(x); | 
 |  |  |                } | 
 |  |  |                dw_list.PostRetrieve(); | 
 |  |  |                //dw_list.PostRetrieve(); | 
 |  |  |                dw_list.Redraw(); | 
 |  |  |  | 
 |  |  |                if (dw_list.GetRowCount() > 0) | 
 |  |  |                { | 
 |  |  |                   xs = GetControl(L"html_detail"); | 
 |  |  |                   xs.SetContent(makeHtml(1)); | 
 |  |  |                   xstring id = g_xdoc_product.getData(0, L"data/Item", 1, L"@guid"); | 
 |  |  |                   xstring id = dw_list.GetItemString(1, L"@guid"); | 
 |  |  |                   OnShowImage(id); | 
 |  |  |                } | 
 |  |  |                else | 
 |  |  | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  |          impStr = L""; | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       int OnTreeSelChanged(TEvent* evt, int p) | 
 |  |  | 
 |  |  |          int len = nlist.length(); | 
 |  |  |          for (int i = 0; i < len; i++) | 
 |  |  |          { | 
 |  |  |             KXMLDOMElement& e = *new KXMLDOMElement(nlist.item(i)); | 
 |  |  |             KXMLDOMElement e = nlist.item(i); | 
 |  |  |             xstring name = e.getAttribute(L"cname"); | 
 |  |  |             xstring sImage = e.getAttribute(L"image"); | 
 |  |  |             int image = 15; | 
 |  |  |             //if(sImage) image = sImage.toInt(); | 
 |  |  |             HTREEITEM h = tv_folder.InsertChildItem(hItem, name, (LPARAM)&e, image); | 
 |  |  |             HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e, image); | 
 |  |  |             tv_folder.SetItemChild(h, 1); | 
 |  |  |             ExpandChildFolder(h, e); | 
 |  |  |          } | 
 |  |  | 
 |  |  |          char ch; | 
 |  |  |          int row = hdr.row; | 
 |  |  |          xstring col = hdr.colname; | 
 |  |  |          xstring str = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SOLineID"); | 
 |  |  |          xstring str = dwc_list.GetItemString(row, L"SOLineID"); | 
 |  |  |          if (str != L"") | 
 |  |  |             str = L"sl:" + str; | 
 |  |  |          else if (dwc_list.GetItemString(row, L"SKUNo") != L"") | 
 |  |  | 
 |  |  |          DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; | 
 |  |  |          int row = hdr.row; | 
 |  |  |          xstring ls_nos = L"ImportXml:"; | 
 |  |  |          xstring str = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SOLineID"); | 
 |  |  |          xstring str1 = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"EnquiryPriceListID"); | 
 |  |  |          xstring str = dwc_list.GetItemString(row, L"SOLineID"); | 
 |  |  |          xstring str1 = dwc_list.GetItemString(row, L"EnquiryPriceListID"); | 
 |  |  |          if (str1 != L"") | 
 |  |  |             str += L"el:" + str1; | 
 |  |  |          else if (str != L"") | 
 |  |  | 
 |  |  |          dw_list.Redraw(); | 
 |  |  |          dwc_list.Redraw(); | 
 |  |  |          impStr = L""; | 
 |  |  |          SendMessage(hObject, 0x401, (LPARAM)ls_nos, 0); | 
 |  |  |          SendMessage(hObject, 0x401, (LPARAM)ls_nos.c_str(), 0); | 
 |  |  |          xutil::RestoreCursor(hCursor); | 
 |  |  |          CloseWindow(); | 
 |  |  |          return 1; | 
 |  |  | 
 |  |  |          dw_list.Redraw(); | 
 |  |  |          dwc_list.Redraw(); | 
 |  |  |          impStr = L""; | 
 |  |  |          SendMessage(hObject, 0x401, (LPARAM)ls_nos, 0); | 
 |  |  |          SendMessage(hObject, 0x401, (LPARAM)ls_nos.c_str(), 0); | 
 |  |  |          xutil::RestoreCursor(hCursor); | 
 |  |  |          CloseWindow(); | 
 |  |  |          return 1; | 
 |  |  | 
 |  |  |          impStr = L""; | 
 |  |  |  | 
 |  |  |          OnAttachEvent(); | 
 |  |  |          imageElement = 0; | 
 |  |  |          //imageElement = 0; | 
 |  |  |  | 
 |  |  |          tv_folder = GetControl(L"tv_folder"); | 
 |  |  |          dw_list = GetControl(L"dw_list"); | 
 |  |  | 
 |  |  |          hObject = 0; | 
 |  |  |          if (arg) | 
 |  |  |          { | 
 |  |  |             hObject = arg.GetArgString(L"HWND").toInt(); | 
 |  |  |             hObject = (HWND)arg.GetParam(L"HWND"); | 
 |  |  |             CustomerID = arg.GetArgString(L"CustomerID"); | 
 |  |  |             CustomerID = arg.GetArgString(L"SupplierID"); | 
 |  |  |          } | 
 |  |  |          InitialFolder(); | 
 |  |  |  | 
 |  |  |          g_xdoc_product = new xdataset; | 
 |  |  |          g_xdoc_product.Init(); | 
 |  |  |          xbind bindproduct = new xbind; | 
 |  |  |          bindproduct.bindEx(dw_list, g_xdoc_product, L""); | 
 |  |  |  | 
 |  |  |          g_xdoc_shoppingcart = new xdataset; | 
 |  |  |          g_xdoc_shoppingcart.Init(); | 
 |  |  |  | 
 |  |  |          xbind bindcart = new xbind; | 
 |  |  |          bindcart.bindEx(dwc_list, g_xdoc_shoppingcart, L""); | 
 |  |  |  | 
 |  |  | 			 | 
 |  |  |          dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3(L"")); | 
 |  |  |          dw_list = GetControl(L"dw_list"); | 
 |  |  |          dw_list.SetReadOnly(true); | 
 |  |  | 
 |  |  |             xs.SetContent(makeHtml(1)); | 
 |  |  |          } | 
 |  |  |  | 
 |  |  |          tv_folder.ExpandItem(tv_folder.GetNextItem(tv_folder.GetRootItem())); | 
 |  |  |          tv_folder.ExpandItem(tv_folder.GetNextItem(tv_folder.GetNextItem(tv_folder.GetRootItem()))); | 
 |  |  | #if 0 | 
 |  |  |          xtreeview::ExpandItem(tv_folder.GetId(), | 
 |  |  |             xtreeview::GetNextItem(tv_folder.GetId(), xtreeview::GetRootItem(tv_folder.GetId()))); | 
 |  |  |          xtreeview::ExpandItem(tv_folder.GetId(), | 
 |  |  |             xtreeview::GetNextItem(tv_folder.GetId(), xtreeview::GetNextItem(tv_folder.GetId(), xtreeview::GetRootItem(tv_folder.GetId())))); | 
 |  |  |  | 
 |  |  | #endif // 0 | 
 |  |  |  | 
 |  |  | 			 | 
 |  |  |          dw_list.SetSelectionMode(3); | 
 |  |  |          dwc_list.SetSelectionMode(3); | 
 |  |  |  |