| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | use "enquiry.view.vd" |
| | | use "quote.view.vd" |
| | | use "publiccode.vutil.vbusiness.vd" |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | #include <xcontrol/xdatetimepick.hpp> |
| | | #include <xcontrol/ximageview.hpp> |
| | | |
| | | unit trade |
| | | [ |
| | | class EnquiryMaintView : public frame |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | #include "viewobject/enquiry.view.hpp" |
| | | #include "viewobject/quote.view.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) EnquiryMaintView : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xdwtable dw_base; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | string sheetname; |
| | | |
| | | xstring sheetname; |
| | | public: |
| | | EnquiryMaintView(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static EnquiryMaintView* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | EnquiryMaintView* pWin = new EnquiryMaintView(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | SetAgentNodeContent(anode, m_agentNode); |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent(anode, s); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //重置工具条 |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | string GetEntityData(int pr) |
| | | xstring GetEntityData(int pr) |
| | | { |
| | | dw_base.AcceptText(); |
| | | dw_goods.AcceptText(); |
| | | if (dw_base.GetItemString(1, "EnquiryNo") == "") |
| | | if (dw_base.GetItemString(1, L"EnquiryNo") == L"") |
| | | { |
| | | string EnquiryNo = EnquiryView::MakeBillNo(); |
| | | dw_base.SetItemString(1, "EnquiryNo", EnquiryNo); |
| | | xstring EnquiryNo = EnquiryView::MakeBillNo(); |
| | | dw_base.SetItemString(1, L"EnquiryNo", EnquiryNo); |
| | | } |
| | | |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_goods.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | dw_base.DwUpdateAllTo(x.GetXmlDoc()); |
| | | return x.GetXml(); |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | dw_goods.DwUpdateAllToEx(x); |
| | | dw_base.DwUpdateAllTo(x); |
| | | return x.xml(); |
| | | } |
| | | |
| | | int SetSeqNo(xdwgrid dw_obj, string SeqNoColumn, int nRow) |
| | | int SetSeqNo(xdwgrid dw_obj, xstring SeqNoColumn, int nRow) |
| | | { |
| | | if (nRow > 1) |
| | | { |
| | |
| | | |
| | | int Adjust() |
| | | { |
| | | string str; |
| | | xstring str; |
| | | for (int i = 1; i <= dw_goods.GetRowCount(); i++) |
| | | { |
| | | str = dw_goods.GetItemString(i, "SupplierID"); |
| | | if (dw_goods.GetItemString(i, "ItemID") != "") |
| | | if (str == "") |
| | | str = dw_goods.GetItemString(i, L"SupplierID"); |
| | | if (dw_goods.GetItemString(i, L"ItemID") != L"") |
| | | if (str == L"") |
| | | { |
| | | if (i > 1) |
| | | { |
| | | if (dw_goods.GetItemString(i - 1, "SupplierID") != "") |
| | | if (dw_goods.GetItemString(i - 1, L"SupplierID") != L"") |
| | | { |
| | | dw_goods.SetItemDisplayString(i, "SupplierID", dw_goods.GetItemDisplayString(i - 1, "SupplierID")); |
| | | dw_goods.ItemChangeTo(i, "SupplierID", dw_goods.GetItemString(i - 1, "SupplierID")); |
| | | dw_goods.SetItemDisplayString(i, L"SupplierID", dw_goods.GetItemDisplayString(i - 1, L"SupplierID")); |
| | | dw_goods.ItemChangeTo(i, L"SupplierID", dw_goods.GetItemString(i - 1, L"SupplierID")); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | dw_base.AcceptText(); |
| | | dw_goods.AcceptText(); |
| | | if (dw_base.GetItemString(1, "Remark") != "保存") |
| | | if (dw_base.GetItemString(1, L"Remark") != L"保存") |
| | | { |
| | | if (dw_base.GetItemString(1, "EnquiryNo") == "") |
| | | if (dw_base.GetItemString(1, L"EnquiryNo") == L"") |
| | | { |
| | | string EnquiryNo = EnquiryView::MakeBillNo(); |
| | | dw_base.SetItemString(1, "EnquiryNo", EnquiryNo); |
| | | xstring EnquiryNo = EnquiryView::MakeBillNo(); |
| | | dw_base.SetItemString(1, L"EnquiryNo", EnquiryNo); |
| | | } |
| | | |
| | | if (dw_base.GetItemString(1, "ValidDay") == "") |
| | | if (dw_base.GetItemString(1, L"ValidDay") == L"") |
| | | { |
| | | alert("请输入有效期!"); |
| | | alert(L"请输入有效期!"); |
| | | return 1; |
| | | } |
| | | /*if(dw_base.GetItemString(1,"SupplierID")=="") |
| | | /*if(dw_base.GetItemString(1,L"SupplierID")==L"") |
| | | { |
| | | alert("供应商为空!"); |
| | | alert(L"供应商为空!"); |
| | | return 1; |
| | | }*/ |
| | | if (dw_base.GetItemString(1, "Source") == "") |
| | | if (dw_base.GetItemString(1, L"Source") == L"") |
| | | { |
| | | alert("请输入询价类别!"); |
| | | alert(L"请输入询价类别!"); |
| | | return 1; |
| | | } |
| | | string Packing = ""; |
| | | string Packings = ""; |
| | | xstring Packing = L""; |
| | | xstring Packings = L""; |
| | | Adjust(); |
| | | for (int i = 1; i <= dw_goods.GetRowCount(); i++) |
| | | { |
| | | if (dw_goods.GetItemString(i, "ItemMiniQty") == "") |
| | | if (dw_goods.GetItemString(i, L"ItemMiniQty") == L"") |
| | | { |
| | | alert("请输入起订量!"); |
| | | alert(L"请输入起订量!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "Picture") == "") |
| | | if (dw_goods.GetItemString(i, L"Picture") == L"") |
| | | { |
| | | alert("请 " + i.toString() + "行,上传产品图片!"); |
| | | alert(L"请 " + xstring(i) + L"行,上传产品图片!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "POPrice") == "" || dw_goods.GetItemString(i, "POPrice") == ".000") |
| | | if (dw_goods.GetItemString(i, L"POPrice") == L"" || dw_goods.GetItemString(i, L"POPrice") == L".000") |
| | | { |
| | | alert("请输入采购价!"); |
| | | alert(L"请输入采购价!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "PriceType") == "") |
| | | if (dw_goods.GetItemString(i, L"PriceType") == L"") |
| | | { |
| | | alert("请输入价格类型!"); |
| | | alert(L"请输入价格类型!"); |
| | | return 1; |
| | | } |
| | | |
| | | if (dw_goods.GetItemString(i, "SampleFee") == "") |
| | | if (dw_goods.GetItemString(i, L"SampleFee") == L"") |
| | | { |
| | | alert("请输入打样费!"); |
| | | alert(L"请输入打样费!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "TestFee") == "") |
| | | if (dw_goods.GetItemString(i, L"TestFee") == L"") |
| | | { |
| | | alert("请输入测试费!"); |
| | | alert(L"请输入测试费!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "ModelFee") == "") |
| | | if (dw_goods.GetItemString(i, L"ModelFee") == L"") |
| | | { |
| | | alert("请输入模具费!"); |
| | | alert(L"请输入模具费!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "VolumeDesc") == "") |
| | | if (dw_goods.GetItemString(i, L"VolumeDesc") == L"") |
| | | { |
| | | alert("请输入包装尺码!"); |
| | | alert(L"请输入包装尺码!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "WarehousingReason") == "") |
| | | if (dw_goods.GetItemString(i, L"WarehousingReason") == L"") |
| | | { |
| | | alert("请输入入库理由!"); |
| | | alert(L"请输入入库理由!"); |
| | | return 1; |
| | | } |
| | | |
| | | /*if(dw_goods.GetItemString(i,"Packing") !="") |
| | | /*if(dw_goods.GetItemString(i,L"Packing") !=L"") |
| | | { |
| | | Packing = dw_goods.GetItemString(i,"Packing"); |
| | | if(Packings=="") |
| | | Packing = dw_goods.GetItemString(i,L"Packing"); |
| | | if(Packings==L"") |
| | | Packings = Packing; |
| | | else if(Packings.find(Packing) < 0) Packings+=","+Packing; |
| | | else if(Packings.find(Packing) < 0) Packings+=L",L"+Packing; |
| | | }*/ |
| | | if (dw_goods.GetItemString(i, "Packing") == "") |
| | | if (dw_goods.GetItemString(i, L"Packing") == L"") |
| | | { |
| | | alert("请输包装方式!"); |
| | | alert(L"请输包装方式!"); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | xml xx = ViewObject::RetrieveData("/sale/data/Enquiry/GetPacking", "str", dw_goods.GetItemString(i, "Packing")); |
| | | string Results = xx.GetXmlDoc().text; |
| | | xml xx = ViewObject::RetrieveData(L"/sale/data/Enquiry/GetPacking", L"str", dw_goods.GetItemString(i, L"Packing")); |
| | | xstring Results = xx.text(); |
| | | int ResultsInt = Results.toInt(); |
| | | if (ResultsInt == 0) |
| | | { |
| | | alert("第" + i.toString() + "行包装方式错误,请重新选择!"); |
| | | alert(L"第" + xstring(i) + L"行包装方式错误,请重新选择!"); |
| | | return 1; |
| | | } |
| | | } |
| | | } |
| | | trace("********" + Packings + "*********"); |
| | | trace(L"********" + Packings + L"*********"); |
| | | } |
| | | |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_goods.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | dw_base.DwUpdateAllTo(x.GetXmlDoc()); |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | dw_goods.DwUpdateAllToEx(x); |
| | | dw_base.DwUpdateAllTo(x); |
| | | |
| | | //alert(x.GetXml()); |
| | | //alert(x.xml()); |
| | | |
| | | string error = ""; |
| | | arg.AddArg("content", x.GetXml()); |
| | | if (url::get("/sale/data/Enquiry/update", arg.GetString(), x) != 1) |
| | | xstring error = L""; |
| | | arg.AddArg(L"content", x.xml()); |
| | | if (xurl::get(L"/sale/data/Enquiry/update", arg.GetString(), x) != 1) |
| | | { |
| | | error = x.GetXmlDoc().text; |
| | | error = x.text(); |
| | | alert(error); |
| | | } |
| | | else |
| | | { |
| | | string str = x.GetXmlDoc().documentElement.getAttribute("text"); |
| | | if (str == "true") |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_goods.ResetUpdateStatus(); |
| | | dw_base.ResetUpdateStatus(); |
| | | UpdateEnquiryLineID(); |
| | | |
| | | xaserverarg arg_ = new xaserverarg; |
| | | arg_.setNativePointer(GetParam()); |
| | | //trace("\r\nSource:"+arg_.GetArgString("Source")); |
| | | if (arg_.GetArgString("Source") == "quote") |
| | | xaserverarg arg_; |
| | | |
| | | //trace(L"\r\nSource:"+arg_.GetArgString(L"Source")); |
| | | if (arg_.GetArgString(L"Source") == L"quote") |
| | | InsertEnquiryPriceList(); |
| | | else if (arg_.GetArgString("Source") == "pricebill") |
| | | else if (arg_.GetArgString(L"Source") == L"pricebill") |
| | | InsertEnquiryPriceListByEnquiryID(); |
| | | |
| | | alert("保存成功!"); |
| | | int hWnd = 0; |
| | | if (arg_.GetArgString("Source") == "pricebill") |
| | | alert(L"保存成功!"); |
| | | HWND hWnd = 0; |
| | | if (arg_.GetArgString(L"Source") == L"pricebill") |
| | | { |
| | | if (arg_.GetArgString("hWnd") != "") |
| | | if (arg_.GetArgString(L"hWnd") != L"") |
| | | { |
| | | hWnd = arg_.GetArgString("hWnd").toInt(); |
| | | win32::PostMessage(hWnd, 0x401, "xmRefresh", 0); |
| | | hWnd = (HWND)arg_.GetParam(L"hWnd"); |
| | | PostMessage(hWnd, 0x401, (LPARAM)L"xmRefresh", 0); |
| | | } |
| | | } |
| | | if (arg_.GetArgString("Source") == "") |
| | | if (arg_.GetArgString(L"Source") == L"") |
| | | { |
| | | if (arg_.GetArgString("hWnd") != "") |
| | | if (arg_.GetArgString(L"hWnd") != L"") |
| | | { |
| | | hWnd = arg_.GetArgString("hWnd").toInt(); |
| | | win32::PostMessage(hWnd, 0x401, "xmReresh", 0); |
| | | hWnd = (HWND)arg_.GetParam(L"hWnd"); |
| | | PostMessage(hWnd, 0x401, (LPARAM)L"xmReresh", 0); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | alert("保存失败!"); |
| | | alert(L"保存失败!"); |
| | | } |
| | | } |
| | | if (x) x.Free(); |
| | | if (x) |
| | | return 1; |
| | | } |
| | | |
| | | int InsertEnquiryPriceListByEnquiryID() |
| | | { |
| | | //trace("\r\nInsertEnquiryPriceListByEnquiryID Start!"); |
| | | xml x = ViewObject::RetrieveData("/sale/data/Enquiry/InsertEnquiryPriceListByEnquiryID", "EnquiryID", dw_base.GetGuid(1)); |
| | | //trace("\r\nInsertEnquiryPriceListByEnquiryID:" + dw_base.GetGuid(1)+" "+ x.GetXml()); |
| | | //trace(L"\r\nInsertEnquiryPriceListByEnquiryID Start!"); |
| | | xml x = ViewObject::RetrieveData(L"/sale/data/Enquiry/InsertEnquiryPriceListByEnquiryID", L"EnquiryID", dw_base.GetGuid(1)); |
| | | //trace(L"\r\nInsertEnquiryPriceListByEnquiryID:" + dw_base.GetGuid(1)+L" "+ x.xml()); |
| | | return 1; |
| | | } |
| | | |
| | | int InsertEnquiryPriceList() |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(GetParam()); |
| | | string EntityIDList = arg.GetArgString("EntityIDList"); |
| | | xml x = ViewObject::RetrieveData("/sale/data/Enquiry/InsertEnquiryPriceList", "ItemList", EntityIDList); |
| | | xml x1 = ViewObject::RetrieveData("/sale/data/Enquiry/Update/UpdateQuoteLine", "ItemList", EntityIDList); |
| | | xaserverarg arg; |
| | | |
| | | xstring EntityIDList = arg.GetArgString(L"EntityIDList"); |
| | | xml x = ViewObject::RetrieveData(L"/sale/data/Enquiry/InsertEnquiryPriceList", L"ItemList", EntityIDList); |
| | | xml x1 = ViewObject::RetrieveData(L"/sale/data/Enquiry/Update/UpdateQuoteLine", L"ItemList", EntityIDList); |
| | | |
| | | return 1; |
| | | } |
| | |
| | | |
| | | int UpdateEnquiryLineID() |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xaserverarg arg; |
| | | |
| | | int row = dw_base.GetRow(); |
| | | if (row < 1) return 0; |
| | | |
| | | string EnquiryID = dw_base.GetGuid(1); |
| | | xstring EnquiryID = dw_base.GetGuid(1); |
| | | |
| | | xml x = ViewObject::RetrieveData("/sale/data/Enquiry/Update/UpdateEnquiryLineID", "EnquiryID", EnquiryID); |
| | | xml x = ViewObject::RetrieveData(L"/sale/data/Enquiry/Update/UpdateEnquiryLineID", L"EnquiryID", EnquiryID); |
| | | return 1; |
| | | } |
| | | |
| | |
| | | { |
| | | dw_base.AcceptText(); |
| | | dw_goods.AcceptText(); |
| | | if (dw_base.GetItemString(1, "EnquiryNo") == "") |
| | | if (dw_base.GetItemString(1, L"EnquiryNo") == L"") |
| | | { |
| | | string EnquiryNo = EnquiryView::MakeBillNo(); |
| | | dw_base.SetItemString(1, "EnquiryNo", EnquiryNo); |
| | | xstring EnquiryNo = EnquiryView::MakeBillNo(); |
| | | dw_base.SetItemString(1, L"EnquiryNo", EnquiryNo); |
| | | } |
| | | |
| | | if (dw_base.GetItemString(1, "ValidDay") == "") |
| | | if (dw_base.GetItemString(1, L"ValidDay") == L"") |
| | | { |
| | | alert("请输入有效期!"); |
| | | alert(L"请输入有效期!"); |
| | | return 1; |
| | | } |
| | | |
| | | if (dw_base.GetItemString(1, "Source") == "") |
| | | if (dw_base.GetItemString(1, L"Source") == L"") |
| | | { |
| | | alert("请输入询价类别!"); |
| | | alert(L"请输入询价类别!"); |
| | | return 1; |
| | | } |
| | | string Packing = ""; |
| | | string Packings = ""; |
| | | xstring Packing = L""; |
| | | xstring Packings = L""; |
| | | for (int i = 1; i <= dw_goods.GetRowCount(); i++) |
| | | { |
| | | if (dw_goods.GetItemString(i, "ItemMiniQty") == "") |
| | | if (dw_goods.GetItemString(i, L"ItemMiniQty") == L"") |
| | | { |
| | | alert("请输入起订量!"); |
| | | alert(L"请输入起订量!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "Picture") == "") |
| | | if (dw_goods.GetItemString(i, L"Picture") == L"") |
| | | { |
| | | alert("请 " + i.toString() + "行,上传产品图片!"); |
| | | alert(L"请 " + xstring(i) + L"行,上传产品图片!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "POPrice") == "" || dw_goods.GetItemString(i, "POPrice") == ".000") |
| | | if (dw_goods.GetItemString(i, L"POPrice") == L"" || dw_goods.GetItemString(i, L"POPrice") == L".000") |
| | | { |
| | | alert("请输入采购价!"); |
| | | alert(L"请输入采购价!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "PriceType") == "") |
| | | if (dw_goods.GetItemString(i, L"PriceType") == L"") |
| | | { |
| | | alert("请输入价格类型!"); |
| | | alert(L"请输入价格类型!"); |
| | | return 1; |
| | | } |
| | | |
| | | if (dw_goods.GetItemString(i, "SampleFee") == "") |
| | | if (dw_goods.GetItemString(i, L"SampleFee") == L"") |
| | | { |
| | | alert("请输入打样费!"); |
| | | alert(L"请输入打样费!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "TestFee") == "") |
| | | if (dw_goods.GetItemString(i, L"TestFee") == L"") |
| | | { |
| | | alert("请输入测试费!"); |
| | | alert(L"请输入测试费!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "ModelFee") == "") |
| | | if (dw_goods.GetItemString(i, L"ModelFee") == L"") |
| | | { |
| | | alert("请输入模具费!"); |
| | | alert(L"请输入模具费!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "VolumeDesc") == "") |
| | | if (dw_goods.GetItemString(i, L"VolumeDesc") == L"") |
| | | { |
| | | alert("请输入包装尺码!"); |
| | | alert(L"请输入包装尺码!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "WarehousingReason") == "") |
| | | if (dw_goods.GetItemString(i, L"WarehousingReason") == L"") |
| | | { |
| | | alert("请输入入库理由!"); |
| | | alert(L"请输入入库理由!"); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | if (dw_goods.GetItemString(i, "Packing") != "") |
| | | if (dw_goods.GetItemString(i, L"Packing") != L"") |
| | | { |
| | | Packing = dw_goods.GetItemString(i, "Packing"); |
| | | if (Packings == "") |
| | | Packing = dw_goods.GetItemString(i, L"Packing"); |
| | | if (Packings == L"") |
| | | Packings = Packing; |
| | | else if (Packings.find(Packing) < 0) Packings += "," + Packing; |
| | | else if (Packings.find(Packing) < 0) Packings += L",L" + Packing; |
| | | } |
| | | } |
| | | |
| | | trace("********" + Packings + "*********"); |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_base.DwUpdateAllTo(x.GetXmlDoc()); |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement; |
| | | trace(L"********" + Packings + L"*********"); |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | dw_base.DwUpdateAllTo(x); |
| | | KXMLDOMElement ele = x.documentElement(); |
| | | |
| | | xml x1 = xml::Make(); |
| | | dw_goods.DwUpdateAllToEx(x1.GetXmlDoc()); |
| | | msxml::IXMLDOMNodeList items = x1.GetXmlDoc().selectNodes("Enquiry/Item"); |
| | | int len = items.length; |
| | | xml x1 ; |
| | | dw_goods.DwUpdateAllToEx(x1); |
| | | KXMLDOMNodeList items = x1.selectNodes(L"Enquiry/Item"); |
| | | int len = items.length(); |
| | | bool processed = false; |
| | | msxml::IXMLDOMNode child; |
| | | msxml::IXMLDOMNode nodeColumn; |
| | | msxml::IXMLDOMElement eleItem; |
| | | msxml::IXMLDOMElement eleColumn; |
| | | string guid; |
| | | KXMLDOMNode child; |
| | | KXMLDOMNode nodeColumn; |
| | | KXMLDOMElement eleItem; |
| | | KXMLDOMElement eleColumn; |
| | | xstring guid; |
| | | for (int k = 0; k < len; k++) |
| | | { |
| | | msxml::IXMLDOMElement e = items.item(k); |
| | | KXMLDOMElement e = items.item(k); |
| | | /*processed = false; |
| | | msxml::IXMLDOMNode col = e.selectSingleNode("QuoteNo"); |
| | | KXMLDOMNode col = e.selectSingleNode(L"QuoteNo"); |
| | | if(col) |
| | | { |
| | | if(col.text !="") |
| | | if(col.text !=L"") |
| | | { |
| | | child = e.cloneNode(-1); |
| | | ele.appendChild(child); |
| | |
| | | } |
| | | if(!processed) |
| | | {*/ |
| | | string itemNew = e.getAttribute("update.new"); |
| | | string itemDelete = e.getAttribute("update.delete"); |
| | | string itemModify = e.getAttribute("update.modify"); |
| | | if (itemDelete == "1") |
| | | xstring itemNew = e.getAttribute(L"update.new"); |
| | | xstring itemDelete = e.getAttribute(L"update.delete"); |
| | | xstring itemModify = e.getAttribute(L"update.modify"); |
| | | if (itemDelete == L"1") |
| | | { |
| | | eleItem = x.GetXmlDoc().createElement("Item"); |
| | | eleItem.setAttribute("update.modify", "1"); |
| | | guid = e.getAttribute("guid"); |
| | | eleItem.setAttribute("guid", guid); |
| | | eleItem = x.createElement(L"Item"); |
| | | eleItem.setAttribute(L"update.modify", L"1"); |
| | | guid = e.getAttribute(L"guid"); |
| | | eleItem.setAttribute(L"guid", guid); |
| | | |
| | | eleColumn = x.GetXmlDoc().createElement("LineType"); |
| | | eleColumn.setAttribute("update.modify", "1"); //delete |
| | | eleColumn.text = "1"; |
| | | eleColumn = x.createElement(L"LineType"); |
| | | eleColumn.setAttribute(L"update.modify", L"1"); //delete |
| | | eleColumn.text = L"1"; |
| | | eleItem.appendChild(eleColumn); |
| | | ele.appendChild(eleItem); |
| | | eleColumn.release(); |
| | | eleItem.release(); |
| | | processed = true; |
| | | } |
| | | else if (itemModify == "1") |
| | | else if (itemModify == L"1") |
| | | { |
| | | if (itemNew != "1") |
| | | if (itemNew != L"1") |
| | | { |
| | | //update origin row |
| | | eleItem = x.GetXmlDoc().createElement("Item"); |
| | | eleItem.setAttribute("update.modify", "1"); |
| | | guid = e.getAttribute("guid"); |
| | | eleItem.setAttribute("guid", guid); |
| | | eleItem = x.createElement(L"Item"); |
| | | eleItem.setAttribute(L"update.modify", L"1"); |
| | | guid = e.getAttribute(L"guid"); |
| | | eleItem.setAttribute(L"guid", guid); |
| | | |
| | | eleColumn = x.GetXmlDoc().createElement("RealEnquiryLineID"); |
| | | eleColumn.setAttribute("update.modify", "1"); |
| | | eleColumn = x.createElement(L"RealEnquiryLineID"); |
| | | eleColumn.setAttribute(L"update.modify", L"1"); |
| | | guid = publiccode::GetGuid(); |
| | | eleColumn.text = guid; |
| | | eleItem.appendChild(eleColumn); |
| | | eleColumn.release(); |
| | | |
| | | eleColumn = x.GetXmlDoc().createElement("LineType"); |
| | | eleColumn.setAttribute("update.modify", "1"); |
| | | eleColumn.text = "1"; //modify |
| | | eleColumn = x.createElement(L"LineType"); |
| | | eleColumn.setAttribute(L"update.modify", L"1"); |
| | | eleColumn.text = L"1"; //modify |
| | | eleItem.appendChild(eleColumn); |
| | | ele.appendChild(eleItem); |
| | | eleColumn.release(); |
| | |
| | | |
| | | //insert new row |
| | | eleItem = e.cloneNode(-1); |
| | | eleItem.setAttribute("update.modify", "1"); |
| | | eleItem.setAttribute("update.new", "1"); |
| | | eleItem.setAttribute("guid", publiccode::GetGuid()); |
| | | eleItem.setAttribute(L"update.modify", L"1"); |
| | | eleItem.setAttribute(L"update.new", L"1"); |
| | | eleItem.setAttribute(L"guid", publiccode::GetGuid()); |
| | | |
| | | eleColumn = x.GetXmlDoc().createElement("LineType"); |
| | | eleColumn.setAttribute("update.modify", "1"); |
| | | eleColumn.text = "0"; //normal |
| | | eleColumn = x.createElement(L"LineType"); |
| | | eleColumn.setAttribute(L"update.modify", L"1"); |
| | | eleColumn.text = L"0"; //normal |
| | | eleItem.appendChild(eleColumn); |
| | | eleColumn.release(); |
| | | |
| | | nodeColumn = e.selectSingleNode("ModifyDate"); |
| | | nodeColumn = e.selectSingleNode(L"ModifyDate"); |
| | | if (!nodeColumn) |
| | | eleColumn = x.GetXmlDoc().createElement("ModifyDate"); |
| | | eleColumn = x.createElement(L"ModifyDate"); |
| | | else |
| | | eleColumn = nodeColumn; |
| | | eleColumn.text = publiccode::GetCurrentDate(); |
| | |
| | | } |
| | | else |
| | | { |
| | | guid = e.getAttribute("guid"); |
| | | guid = e.getAttribute(L"guid"); |
| | | child = e.cloneNode(-1); |
| | | child.selectSingleNode("RealEnquiryLineID").text = guid; |
| | | child.selectSingleNode("RelEnquiryLineID").text = guid; |
| | | child.selectSingleNode(L"RealEnquiryLineID").text = guid; |
| | | child.selectSingleNode(L"RelEnquiryLineID").text = guid; |
| | | ele.appendChild(child); |
| | | //trace(child.xml); |
| | | child.release(); |
| | |
| | | //} |
| | | e.release(); |
| | | } |
| | | x1.Free(); |
| | | string error = ""; |
| | | arg.AddArg("content", x.GetXml()); |
| | | if (url::get("/sale/data/Enquiry/update", arg.GetString(), x) != 1) |
| | | |
| | | xstring error = L""; |
| | | arg.AddArg(L"content", x.xml()); |
| | | if (xurl::get(L"/sale/data/Enquiry/update", arg.GetString(), x) != 1) |
| | | { |
| | | error = x.GetXmlDoc().text; |
| | | error = x.text(); |
| | | alert(error); |
| | | } |
| | | else |
| | | { |
| | | string str = x.GetXmlDoc().documentElement.getAttribute("text"); |
| | | if (str == "true") |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | alert("保存成功!"); |
| | | alert(L"保存成功!"); |
| | | //dw_goods.ResetUpdateStatus(); |
| | | //dw_base.ResetUpdateStatus(); |
| | | OnRetrieve(dw_base.GetItemString(1, "EnquiryNo")); |
| | | OnRetrieve(dw_base.GetItemString(1, L"EnquiryNo")); |
| | | } |
| | | else |
| | | { |
| | | alert("保存失败!"); |
| | | alert(L"保存失败!"); |
| | | } |
| | | } |
| | | if (x) x.Free(); |
| | | if (x) |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int ImportProductByText(string str) |
| | | int ImportProductByText(xstring str) |
| | | { |
| | | string CustomerID = dw_base.GetItemString(1, "CustomerID"); |
| | | //trace("Customer:"+CustomerID); |
| | | xstring CustomerID = dw_base.GetItemString(1, L"CustomerID"); |
| | | //trace(L"Customer:"+CustomerID); |
| | | xml x; |
| | | if (CustomerID == "") |
| | | if (CustomerID == L"") |
| | | x = QuoteView::LookupProductsByText(str); |
| | | else |
| | | x = QuoteView::LookupProductsByText(str, CustomerID); |
| | | |
| | | if (!x) return 1; |
| | | msxml::IXMLDOMNodeList items = x.GetXmlDoc().selectNodes("/Items/Item"); |
| | | trace("********" + x.GetXml() + "********"); |
| | | int len = items.length; |
| | | if (str.find(" ") < 0 && len > 0) len = 1; |
| | | KXMLDOMNodeList items = x.selectNodes(L"/Items/Item"); |
| | | //trace(L"********" + x.xml() + L"********"); |
| | | int len = items.length(); |
| | | if (str.find(L" ") < 0 && len > 0) len = 1; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | msxml::IXMLDOMElement e = items.item(i); |
| | | KXMLDOMElement e = items.item(i); |
| | | dw_goods.InsertRow(0); |
| | | int nRow = dw_goods.GetRowCount(); |
| | | SetSeqNo(dw_goods, "SeqNo", nRow); |
| | | dw_goods.SetItemString(nRow, "UOMCode", "007"); |
| | | dw_goods.SetItemDisplayString(nRow, "UOMCode", "PCS"); |
| | | dw_goods.SetItemString(nRow, "KOPCode", "120"); |
| | | dw_goods.SetItemDisplayString(nRow, "KOPCode", "CTNS"); |
| | | dw_goods.SetItemString(nRow, "SKUNo", e.getAttribute("SKUNo")); |
| | | dw_goods.SetItemString(nRow, "ItemID", e.getAttribute("SKUID")); |
| | | //dw_goods.SetItemString(nRow,"ItemName",e.getAttribute("EName")); |
| | | dw_goods.SetItemString(nRow, "ItemName", e.getAttribute("CName")); |
| | | dw_goods.SetItemString(nRow, "GoodsNo", e.getAttribute("GoodsNo")); |
| | | dw_goods.SetItemString(nRow, "CustomerItemNo", e.getAttribute("CustomerItemNo")); |
| | | dw_goods.SetItemString(nRow, "Packing", e.getAttribute("Packing")); |
| | | dw_goods.SetItemString(nRow, "VolumeDesc", e.getAttribute("VolumeDesc")); |
| | | dw_goods.SetItemString(nRow, "PackingRate", e.getAttribute("QtyPerPkg")); |
| | | dw_goods.SetItemString(nRow, "InnerQty", e.getAttribute("InnerQty")); |
| | | dw_goods.SetItemString(nRow, "VATRefundRate", e.getAttribute("VATRefundRate")); |
| | | dw_goods.SetItemString(nRow, "VATRate", e.getAttribute("VATRate")); |
| | | dw_goods.SetItemString(nRow, "HSCode", e.getAttribute("HSCode")); |
| | | //trace("+++++"+e.getAttribute("Picture")+"+++++"); |
| | | dw_goods.SetItemString(nRow, "Picture", e.getAttribute("Picture")); |
| | | SetSeqNo(dw_goods, L"SeqNo", nRow); |
| | | dw_goods.SetItemString(nRow, L"UOMCode", L"007"); |
| | | dw_goods.SetItemDisplayString(nRow, L"UOMCode", L"PCS"); |
| | | dw_goods.SetItemString(nRow, L"KOPCode", L"120"); |
| | | dw_goods.SetItemDisplayString(nRow, L"KOPCode", L"CTNS"); |
| | | dw_goods.SetItemString(nRow, L"SKUNo", e.getAttribute(L"SKUNo")); |
| | | dw_goods.SetItemString(nRow, L"ItemID", e.getAttribute(L"SKUID")); |
| | | //dw_goods.SetItemString(nRow,L"ItemName",e.getAttribute(L"EName")); |
| | | dw_goods.SetItemString(nRow, L"ItemName", e.getAttribute(L"CName")); |
| | | dw_goods.SetItemString(nRow, L"GoodsNo", e.getAttribute(L"GoodsNo")); |
| | | dw_goods.SetItemString(nRow, L"CustomerItemNo", e.getAttribute(L"CustomerItemNo")); |
| | | dw_goods.SetItemString(nRow, L"Packing", e.getAttribute(L"Packing")); |
| | | dw_goods.SetItemString(nRow, L"VolumeDesc", e.getAttribute(L"VolumeDesc")); |
| | | dw_goods.SetItemString(nRow, L"PackingRate", e.getAttribute(L"QtyPerPkg")); |
| | | dw_goods.SetItemString(nRow, L"InnerQty", e.getAttribute(L"InnerQty")); |
| | | dw_goods.SetItemString(nRow, L"VATRefundRate", e.getAttribute(L"VATRefundRate")); |
| | | dw_goods.SetItemString(nRow, L"VATRate", e.getAttribute(L"VATRate")); |
| | | dw_goods.SetItemString(nRow, L"HSCode", e.getAttribute(L"HSCode")); |
| | | //trace(L"+++++L"+e.getAttribute(L"Picture")+L"+++++L"); |
| | | dw_goods.SetItemString(nRow, L"Picture", e.getAttribute(L"Picture")); |
| | | |
| | | if (dw_goods.GetItemString(nRow, "VolumeDesc") != "" && |
| | | dw_goods.GetItemString(nRow, "Packages") != "") |
| | | if (dw_goods.GetItemString(nRow, L"VolumeDesc") != L"" && |
| | | dw_goods.GetItemString(nRow, L"Packages") != L"") |
| | | { |
| | | int qty = EvalQtyPerFCL45H(nRow); |
| | | dw_goods.SetItemString(nRow, "Packages45H", qty.toString()); |
| | | dw_goods.SetItemDouble(nRow, "TransportationFee", 5000.0 / qty); |
| | | dw_goods.SetItemString(nRow, L"Packages45H", xstring(qty)); |
| | | dw_goods.SetItemDouble(nRow, L"TransportationFee", 5000.0 / qty); |
| | | } |
| | | /* |
| | | dw_goods.SetItemString(nRow,"NwPerPkg",e.getAttribute("NwPerPkg")); |
| | | dw_goods.SetItemString(nRow,"GwPerPkg",e.getAttribute("GwPerPkg")); |
| | | dw_goods.SetItemString(nRow,"QTYPerPk",e.getAttribute("QTYPerPk")); |
| | | dw_goods.SetItemString(nRow,"InnerQty",e.getAttribute("InnerQty")); |
| | | dw_goods.SetItemString(nRow,L"NwPerPkg",e.getAttribute(L"NwPerPkg")); |
| | | dw_goods.SetItemString(nRow,L"GwPerPkg",e.getAttribute(L"GwPerPkg")); |
| | | dw_goods.SetItemString(nRow,L"QTYPerPk",e.getAttribute(L"QTYPerPk")); |
| | | dw_goods.SetItemString(nRow,L"InnerQty",e.getAttribute(L"InnerQty")); |
| | | */ |
| | | } |
| | | |
| | | int row = dw_goods.GetRow(); |
| | | if (row >= 1) |
| | | { |
| | | imageview im = GetControl("im1"); |
| | | im.ResetEx(); |
| | | string skuno = dw_goods.GetItemString(row, "SKUNo"); |
| | | ximageview im = GetControl(L"im1"); |
| | | im.Reset(); |
| | | xstring skuno = dw_goods.GetItemString(row, L"SKUNo"); |
| | | OnShowImage(skuno, row); |
| | | im.Redraw(); |
| | | } |
| | |
| | | double EvalCost(int row) |
| | | { |
| | | double cost = 0.0; |
| | | cost += dw_goods.GetItemDouble(row, "POPrice"); |
| | | cost += dw_goods.GetItemDouble(row, "PaperCardPrice"); |
| | | cost += dw_goods.GetItemDouble(row, "TransportationFee"); |
| | | cost += dw_goods.GetItemDouble(row, "OtherFee"); |
| | | cost += dw_goods.GetItemDouble(row, "ManagementFee"); |
| | | cost += dw_goods.GetItemDouble(row, L"POPrice"); |
| | | cost += dw_goods.GetItemDouble(row, L"PaperCardPrice"); |
| | | cost += dw_goods.GetItemDouble(row, L"TransportationFee"); |
| | | cost += dw_goods.GetItemDouble(row, L"OtherFee"); |
| | | cost += dw_goods.GetItemDouble(row, L"ManagementFee"); |
| | | return cost; |
| | | } |
| | | |
| | | double EvalRefund(int row) |
| | | { |
| | | double VATRefundRate = dw_goods.GetItemDouble(row, "VATRefundRate"); |
| | | double VATRefund = dw_goods.GetItemDouble(row, "POPrice") * VATRefundRate / 117.0; |
| | | VATRefund += dw_goods.GetItemDouble(row, "PaperCardPrice") * 13.0 / 117.0; |
| | | double VATRefundRate = dw_goods.GetItemDouble(row, L"VATRefundRate"); |
| | | double VATRefund = dw_goods.GetItemDouble(row, L"POPrice") * VATRefundRate / 117.0; |
| | | VATRefund += dw_goods.GetItemDouble(row, L"PaperCardPrice") * 13.0 / 117.0; |
| | | return VATRefund; |
| | | } |
| | | |
| | | int EvalQtyPerFCL45H(int row) |
| | | { |
| | | double vol = EvalVol(dw_goods.GetItemString(row, "VolumeDesc")); |
| | | double packages = dw_goods.GetItemDouble(row, "Packages"); |
| | | return (packages * 67.0 / vol).toInt(); |
| | | double vol = EvalVol(dw_goods.GetItemString(row, L"VolumeDesc")); |
| | | double packages = dw_goods.GetItemDouble(row, L"Packages"); |
| | | return xdouble((packages * 67.0 / vol)).toInt(); |
| | | } |
| | | double EvalUnitProfit(int row) |
| | | { |
| | | double ExchangeRate = dw_base.GetItemDouble(1, "ExchangeRate"); |
| | | double FobUnitPrice = dw_goods.GetItemDouble(row, "FobUnitPrice"); |
| | | double UnitCost = dw_goods.GetItemDouble(row, "UnitCost"); |
| | | double VATRefund = dw_goods.GetItemDouble(row, "VATRefund"); |
| | | double ExchangeRate = dw_base.GetItemDouble(1, L"ExchangeRate"); |
| | | double FobUnitPrice = dw_goods.GetItemDouble(row, L"FobUnitPrice"); |
| | | double UnitCost = dw_goods.GetItemDouble(row, L"UnitCost"); |
| | | double VATRefund = dw_goods.GetItemDouble(row, L"VATRefund"); |
| | | return ExchangeRate * FobUnitPrice - UnitCost + VATRefund; |
| | | } |
| | | |
| | | double EvalProfitRate(int row) |
| | | { |
| | | double UnitProfit = EvalUnitProfit(row); |
| | | double UnitCost = dw_goods.GetItemDouble(row, "UnitCost"); |
| | | double UnitCost = dw_goods.GetItemDouble(row, L"UnitCost"); |
| | | return UnitProfit / UnitCost; |
| | | } |
| | | double EvalSaleProfitRate(int row) |
| | | { |
| | | double UnitProfit = EvalUnitProfit(row); |
| | | double FobUnitPrice = dw_goods.GetItemDouble(row, "FobUnitPrice"); |
| | | double FobUnitPrice = dw_goods.GetItemDouble(row, L"FobUnitPrice"); |
| | | return UnitProfit / FobUnitPrice; |
| | | } |
| | | |
| | | double EvalExchangeCostRate(int row) |
| | | { |
| | | double FobUnitPrice = dw_goods.GetItemDouble(row, "FobUnitPrice"); |
| | | double UnitCost = dw_goods.GetItemDouble(row, "UnitCost"); |
| | | double VATRefund = dw_goods.GetItemDouble(row, "VATRefund"); |
| | | double FobUnitPrice = dw_goods.GetItemDouble(row, L"FobUnitPrice"); |
| | | double UnitCost = dw_goods.GetItemDouble(row, L"UnitCost"); |
| | | double VATRefund = dw_goods.GetItemDouble(row, L"VATRefund"); |
| | | return (UnitCost - VATRefund) / FobUnitPrice; |
| | | } |
| | | |
| | | double EvalTransportationFee(int row) |
| | | { |
| | | double vol = EvalVol(dw_goods.GetItemString(row, "VolumeDesc")); |
| | | double packages = dw_goods.GetItemDouble(row, "Packages"); |
| | | double vol = EvalVol(dw_goods.GetItemString(row, L"VolumeDesc")); |
| | | double packages = dw_goods.GetItemDouble(row, L"Packages"); |
| | | return 80 * vol / packages; |
| | | } |
| | | |
| | | double EvalVol(string value) |
| | | double EvalVol(xstring value) |
| | | { |
| | | double vol = 1.0; |
| | | string volstr = value; |
| | | int pos1 = volstr.find("*"); |
| | | int pos2 = volstr.find("X"); |
| | | int pos3 = volstr.find("x"); |
| | | xstring volstr = value; |
| | | int pos1 = volstr.find(L"*"); |
| | | int pos2 = volstr.find(L"X"); |
| | | int pos3 = volstr.find(L"x"); |
| | | int pos = pos1; |
| | | //trace("pos: "+ pos.toString() + "pos1: "+ pos1.toString() + "pos2: "+ pos2.toString() +"pos3: "+ pos3.toString()); |
| | | //trace(L"pos: "+ pos.toString() + L"pos1: "+ pos1.toString() + L"pos2: "+ pos2.toString() +L"pos3: "+ pos3.toString()); |
| | | if (pos2 > 0 && pos == -1) pos = pos2; |
| | | if (pos2 >= 0 && pos2 < pos) pos = pos2; |
| | | //trace("pos: "+ pos.toString() + "pos1: "+ pos1.toString() + "pos2: "+ pos2.toString() +"pos3: "+ pos3.toString()); |
| | | //trace(L"pos: "+ pos.toString() + L"pos1: "+ pos1.toString() + L"pos2: "+ pos2.toString() +L"pos3: "+ pos3.toString()); |
| | | if (pos3 > 0 && pos == -1) pos = pos3; |
| | | if (pos3 >= 0 && pos3 < pos) pos = pos3; |
| | | //trace("pos: "+ pos.toString() + "pos1: "+ pos1.toString() + "pos2: "+ pos2.toString() +"pos3: "+ pos3.toString()); |
| | | //trace(L"pos: "+ pos.toString() + L"pos1: "+ pos1.toString() + L"pos2: "+ pos2.toString() +L"pos3: "+ pos3.toString()); |
| | | while (pos >= 0) |
| | | { |
| | | string tm = volstr.left(pos); |
| | | xstring tm = volstr.left(pos); |
| | | volstr = volstr.mid(pos + 1, 9999); |
| | | vol *= tm.toDouble(); |
| | | |
| | | pos1 = volstr.find("*"); |
| | | pos2 = volstr.find("X"); |
| | | pos3 = volstr.find("x"); |
| | | pos1 = volstr.find(L"*"); |
| | | pos2 = volstr.find(L"X"); |
| | | pos3 = volstr.find(L"x"); |
| | | pos = pos1; |
| | | if (pos2 > 0 && pos == -1) pos = pos2; |
| | | if (pos2 >= 0 && pos2 < pos) pos = pos2; |
| | | if (pos3 > 0 && pos == -1) pos = pos3; |
| | | if (pos3 >= 0 && pos3 < pos) pos = pos3; |
| | | } |
| | | if (volstr != "") vol *= volstr.toDouble(); |
| | | if (volstr != L"") vol *= volstr.toDouble(); |
| | | return vol / 1000000.0; |
| | | } |
| | | |
| | | int OnShare() |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("EntityID", dw_base.GetGuid(1)); |
| | | //arg.AddArg("EntityName", GetEntityName(0)); |
| | | arg.AddArg("EntityName", "Enquiry3"); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"EntityID", dw_base.GetGuid(1)); |
| | | //arg.AddArg(L"EntityName", GetEntityName(0)); |
| | | arg.AddArg(L"EntityName", L"Enquiry3"); |
| | | |
| | | OpenWindow("dev:xpage[UserGroupShare.vx]", cast(arg as int)); |
| | | OpenWindow(L"dev:xpage[UserGroupShare.vx]",arg ); |
| | | return 1; |
| | | } |
| | | |
| | | int OnItemChanged(ref TNotifyEvent evt, int p) |
| | | int OnItemChanged(TEvent* evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | string colname = hdr.colname; |
| | | string value = hdr.data; |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | xstring value = hdr.data; |
| | | int row = hdr.row; |
| | | |
| | | double VATRefund = 0.0; |
| | | double VATRefundRate = 0.0; |
| | | if ((colname == "GoodsNo" || colname == "CustomerItemNo") && value != "") |
| | | if ((colname == L"GoodsNo" || colname == L"CustomerItemNo") && value != L"") |
| | | { |
| | | if (colname == "CustomerItemNo") |
| | | if (colname == L"CustomerItemNo") |
| | | { |
| | | if (dw_goods.GetItemString(row, "GoodsNo") != "") return 1; |
| | | if (dw_goods.GetItemString(row, L"GoodsNo") != L"") return 1; |
| | | } |
| | | xml x; |
| | | string CustomerID = dw_base.GetItemString(1, "CustomerID"); |
| | | string sval = value; |
| | | if (colname == "GoodsNo") |
| | | xstring CustomerID = dw_base.GetItemString(1, L"CustomerID"); |
| | | xstring sval = value; |
| | | if (colname == L"GoodsNo") |
| | | { |
| | | if (CustomerID != "") |
| | | sval = "gs:" + value; |
| | | if (CustomerID != L"") |
| | | sval = L"gs:" + value; |
| | | else |
| | | sval = value; |
| | | } |
| | | if (colname == "CustomerItemNo") |
| | | /*sval="cs:"+value; |
| | | if(CustomerID !="") |
| | | if (colname == L"CustomerItemNo") |
| | | /*sval=L"cs:"+value; |
| | | if(CustomerID !=L"") |
| | | x = QuoteView::LookupProductsByText(sval,CustomerID ); |
| | | else |
| | | x = QuoteView::LookupProductsByText(sval);*/ |
| | | sval = value; |
| | | x = ViewObject::RetrieveData("/sale/data/Quote/LookGDN", "str", sval); |
| | | x = ViewObject::RetrieveData(L"/sale/data/Quote/LookGDN", L"str", sval); |
| | | if (!x) return 1; |
| | | msxml::IXMLDOMNodeList items = x.GetXmlDoc().selectNodes("/Items/Item"); |
| | | trace(x.GetXml()); |
| | | int len = items.length; |
| | | KXMLDOMNodeList items = x.selectNodes(L"/Items/Item"); |
| | | trace(x.xml()); |
| | | int len = items.length(); |
| | | if (len == 0) |
| | | { |
| | | if (colname == "GoodsNo") |
| | | if (colname == L"GoodsNo") |
| | | { |
| | | alert("没有此公司型号!"); |
| | | dw_goods.SetItemString(dw_goods.GetRow(), "GoodsNo", ""); |
| | | alert(L"没有此公司型号!"); |
| | | dw_goods.SetItemString(dw_goods.GetRow(), L"GoodsNo", L""); |
| | | } |
| | | return 1; |
| | | } |
| | | if (len >= 1) |
| | | { |
| | | msxml::IXMLDOMElement e = items.item(0); |
| | | KXMLDOMElement e = items.item(0); |
| | | int nRow = dw_goods.GetRow(); |
| | | dw_goods.SetItemString(nRow, "SKUNo", e.getAttribute("SKUNo")); |
| | | dw_goods.SetItemString(nRow, "ItemID", e.getAttribute("SKUID")); |
| | | dw_goods.SetItemString(nRow, "ItemName", e.getAttribute("CName")); |
| | | if (colname == "CustomerItemNo")dw_goods.SetItemString(nRow, "GoodsNo", e.getAttribute("GoodsNo")); |
| | | if (colname == "GoodsNo")dw_goods.SetItemString(nRow, "CustomerItemNo", e.getAttribute("CustomerItemNo")); |
| | | dw_goods.SetItemString(nRow, "Packing", e.getAttribute("Packing")); |
| | | dw_goods.SetItemString(nRow, "InnerQty", e.getAttribute("InnerQty")); |
| | | dw_goods.SetItemString(nRow, "PackingRate", e.getAttribute("PackingRate")); |
| | | dw_goods.SetItemString(nRow, "VolumeDesc", e.getAttribute("VolumeDesc")); |
| | | dw_goods.SetItemString(nRow, "Packages", e.getAttribute("QTYPerPkg")); |
| | | dw_goods.SetItemString(nRow, "SupplierID", e.getAttribute("SupplierID")); |
| | | dw_goods.SetItemDisplayString(nRow, "SupplierID", e.getAttribute("SupplierID1")); |
| | | dw_goods.SetItemString(nRow, "POCreatorID", e.getAttribute("POCreatorID")); |
| | | dw_goods.SetItemDisplayString(nRow, "POCreatorID", e.getAttribute("POCreatorID1")); |
| | | dw_goods.SetItemString(nRow, "Picture", e.getAttribute("Picture")); |
| | | dw_goods.SetItemString(nRow, L"SKUNo", e.getAttribute(L"SKUNo")); |
| | | dw_goods.SetItemString(nRow, L"ItemID", e.getAttribute(L"SKUID")); |
| | | dw_goods.SetItemString(nRow, L"ItemName", e.getAttribute(L"CName")); |
| | | if (colname == L"CustomerItemNo")dw_goods.SetItemString(nRow, L"GoodsNo", e.getAttribute(L"GoodsNo")); |
| | | if (colname == L"GoodsNo")dw_goods.SetItemString(nRow, L"CustomerItemNo", e.getAttribute(L"CustomerItemNo")); |
| | | dw_goods.SetItemString(nRow, L"Packing", e.getAttribute(L"Packing")); |
| | | dw_goods.SetItemString(nRow, L"InnerQty", e.getAttribute(L"InnerQty")); |
| | | dw_goods.SetItemString(nRow, L"PackingRate", e.getAttribute(L"PackingRate")); |
| | | dw_goods.SetItemString(nRow, L"VolumeDesc", e.getAttribute(L"VolumeDesc")); |
| | | dw_goods.SetItemString(nRow, L"Packages", e.getAttribute(L"QTYPerPkg")); |
| | | dw_goods.SetItemString(nRow, L"SupplierID", e.getAttribute(L"SupplierID")); |
| | | dw_goods.SetItemDisplayString(nRow, L"SupplierID", e.getAttribute(L"SupplierID1")); |
| | | dw_goods.SetItemString(nRow, L"POCreatorID", e.getAttribute(L"POCreatorID")); |
| | | dw_goods.SetItemDisplayString(nRow, L"POCreatorID", e.getAttribute(L"POCreatorID1")); |
| | | dw_goods.SetItemString(nRow, L"Picture", e.getAttribute(L"Picture")); |
| | | |
| | | if (dw_goods.GetItemString(nRow, "VolumeDesc") != "" && |
| | | dw_goods.GetItemString(nRow, "Packages") != "") |
| | | if (dw_goods.GetItemString(nRow, L"VolumeDesc") != L"" && |
| | | dw_goods.GetItemString(nRow, L"Packages") != L"") |
| | | { |
| | | int qty1 = EvalQtyPerFCL45H(nRow); |
| | | dw_goods.SetItemString(nRow, "Packages45H", qty1.toString()); |
| | | dw_goods.SetItemDouble(nRow, "TransportationFee", 5000.0 / qty1); |
| | | dw_goods.SetItemString(nRow, L"Packages45H", xstring(qty1)); |
| | | dw_goods.SetItemDouble(nRow, L"TransportationFee", 5000.0 / qty1); |
| | | } |
| | | dw_goods.Redraw(); |
| | | } |
| | | } |
| | | |
| | | else if (colname == "POPrice" || colname == "PaperCardPrice" || colname == "TransportationFee" || |
| | | colname == "OtherFee" || colname == "ManagementFee") |
| | | else if (colname == L"POPrice" || colname == L"PaperCardPrice" || colname == L"TransportationFee" || |
| | | colname == L"OtherFee" || colname == L"ManagementFee") |
| | | { |
| | | dw_goods.SetItemDouble(row, "UnitCost", EvalCost(row)); |
| | | dw_goods.SetItemDouble(row, L"UnitCost", EvalCost(row)); |
| | | |
| | | if ((colname == "POPrice" || colname == "PaperCardPrice") && dw_goods.GetItemString(row, "VATRefundRate") != "") |
| | | if ((colname == L"POPrice" || colname == L"PaperCardPrice") && dw_goods.GetItemString(row, L"VATRefundRate") != L"") |
| | | { |
| | | dw_goods.SetItemDouble(row, "VATRefund", EvalRefund(row)); |
| | | dw_goods.SetItemDouble(row, L"VATRefund", EvalRefund(row)); |
| | | } |
| | | } |
| | | else if (colname == "VATRefundRate" && value != "") |
| | | else if (colname == L"VATRefundRate" && value != L"") |
| | | { |
| | | dw_goods.SetItemDouble(row, "VATRefund", EvalRefund(row)); |
| | | dw_goods.SetItemDouble(row, L"VATRefund", EvalRefund(row)); |
| | | } |
| | | else if (colname == "VolumeDesc" || colname == "Packages") |
| | | else if (colname == L"VolumeDesc" || colname == L"Packages") |
| | | { |
| | | if (dw_goods.GetItemString(row, "VolumeDesc") != "" && |
| | | dw_goods.GetItemString(row, "Packages") != "") |
| | | if (dw_goods.GetItemString(row, L"VolumeDesc") != L"" && |
| | | dw_goods.GetItemString(row, L"Packages") != L"") |
| | | { |
| | | int qty = EvalQtyPerFCL45H(row); |
| | | dw_goods.SetItemString(row, "Packages45H", qty.toString()); |
| | | dw_goods.SetItemDouble(row, "TransportationFee", EvalTransportationFee(row)); |
| | | dw_goods.SetItemDouble(row, "UnitCost", EvalCost(row)); |
| | | dw_goods.SetItemString(row, L"Packages45H", xstring(qty)); |
| | | dw_goods.SetItemDouble(row, L"TransportationFee", EvalTransportationFee(row)); |
| | | dw_goods.SetItemDouble(row, L"UnitCost", EvalCost(row)); |
| | | } |
| | | } |
| | | else if (colname == "FobUnitPrice") |
| | | else if (colname == L"FobUnitPrice") |
| | | { |
| | | string CurrencyCode = dw_base.GetItemString(1, "CurrencyCode"); |
| | | string expRate = ""; |
| | | string exchRate = ""; |
| | | xstring CurrencyCode = dw_base.GetItemString(1, L"CurrencyCode"); |
| | | xstring expRate = L""; |
| | | xstring exchRate = L""; |
| | | |
| | | xml x0 = ViewObject::RetrieveData("/sale/data/GDN3/profit/param", "item", "dcomp_amt"); |
| | | if (x0.GetXmlDoc().selectSingleNode("root/item/@value")) |
| | | expRate = x0.GetXmlDoc().selectSingleNode("root/item/@value").text; |
| | | x0 = ViewObject::RetrieveData("/sale/data/GDN3/profit/param", "item", "cryrate"); |
| | | if (x0.GetXmlDoc().selectSingleNode("root/item/@value")) |
| | | exchRate = x0.GetXmlDoc().selectSingleNode("root/item/@value").text; |
| | | xml x0 = ViewObject::RetrieveData(L"/sale/data/GDN3/profit/param", L"item", L"dcomp_amt"); |
| | | if (x0.selectSingleNode(L"root/item/@value")) |
| | | expRate = x0.selectSingleNode(L"root/item/@value").text(); |
| | | x0 = ViewObject::RetrieveData(L"/sale/data/GDN3/profit/param", L"item", L"cryrate"); |
| | | if (x0.selectSingleNode(L"root/item/@value")) |
| | | exchRate = x0.selectSingleNode(L"root/item/@value").text(); |
| | | double r1 = exchRate.toDouble(); |
| | | double r2 = expRate.toDouble(); |
| | | double val = value.toDouble(); |
| | | if (CurrencyCode == "RMB" || CurrencyCode == "CNY") |
| | | if (CurrencyCode == L"RMB" || CurrencyCode == L"CNY") |
| | | { |
| | | if (exchRate != "") |
| | | if (exchRate != L"") |
| | | { |
| | | double ManagementFee = (val / r1) * r2; |
| | | double OtherFee = (val / r1) * 0.2; |
| | | dw_goods.SetItemDouble(row, "ManagementFee", ManagementFee); |
| | | dw_goods.SetItemDouble(row, "OtherFee", OtherFee); |
| | | dw_goods.SetItemDouble(row, L"ManagementFee", ManagementFee); |
| | | dw_goods.SetItemDouble(row, L"OtherFee", OtherFee); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | dw_goods.SetItemDouble(row, "ManagementFee", val * 0.15); |
| | | dw_goods.SetItemDouble(row, "OtherFee", val * 0.2); |
| | | dw_goods.SetItemDouble(row, L"ManagementFee", val * 0.15); |
| | | dw_goods.SetItemDouble(row, L"OtherFee", val * 0.2); |
| | | } |
| | | dw_goods.SetItemDouble(row, "UnitCost", EvalCost(row)); |
| | | dw_goods.SetItemDouble(row, L"UnitCost", EvalCost(row)); |
| | | } |
| | | if (dw_goods.GetItemString(row, "FobUnitPrice") != "" && |
| | | dw_goods.GetItemString(row, "POPrice") != "" && |
| | | dw_goods.GetItemString(row, "VolumeDesc") != "" && |
| | | dw_goods.GetItemString(row, "Packages") != "") |
| | | if (dw_goods.GetItemString(row, L"FobUnitPrice") != L"" && |
| | | dw_goods.GetItemString(row, L"POPrice") != L"" && |
| | | dw_goods.GetItemString(row, L"VolumeDesc") != L"" && |
| | | dw_goods.GetItemString(row, L"Packages") != L"") |
| | | { |
| | | dw_goods.SetItemDouble(row, "UnitProfit", EvalUnitProfit(row)); |
| | | dw_goods.SetItemDouble(row, "ProfitRate", EvalProfitRate(row)); |
| | | dw_goods.SetItemDouble(row, "SaleProfitRate", EvalSaleProfitRate(row)); |
| | | dw_goods.SetItemDouble(row, "ExchangeCostRate", EvalExchangeCostRate(row)); |
| | | dw_goods.SetItemDouble(row, L"UnitProfit", EvalUnitProfit(row)); |
| | | dw_goods.SetItemDouble(row, L"ProfitRate", EvalProfitRate(row)); |
| | | dw_goods.SetItemDouble(row, L"SaleProfitRate", EvalSaleProfitRate(row)); |
| | | dw_goods.SetItemDouble(row, L"ExchangeCostRate", EvalExchangeCostRate(row)); |
| | | } |
| | | |
| | | dw_goods.SetItemString(row, "ModifyDate", publiccode::GetCurrentDate()); |
| | | dw_goods.SetItemString(row, L"ModifyDate", publiccode::GetCurrentDate()); |
| | | dw_goods.Redraw(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnBaseItemChanged(ref TNotifyEvent evt, int p) |
| | | int OnBaseItemChanged(TEvent* evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | string colname = hdr.colname; |
| | | string value = hdr.data; |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | xstring value = hdr.data; |
| | | |
| | | string dwname = "dw_base"; |
| | | if (value != "") |
| | | xstring dwname = L"dw_base"; |
| | | if (value != L"") |
| | | { |
| | | //trace("\r\nsupplierid:"+value); |
| | | msxml::IXMLDOMNodeList nlist = GetElement().selectNodes("//*[@name='" + dwname + "']/trans[@for='" + colname + "']"); |
| | | //trace(L"\r\nsupplierid:"+value); |
| | | KXMLDOMNodeList nlist = GetElement().selectNodes(L"//*[@name='" + dwname + L"']/trans[@for='" + colname + L"']"); |
| | | ViewObject::TransData(nlist, dw_base, hdr.row, colname, value); |
| | | } |
| | | if (colname == "ExchangeRate") |
| | | if (colname == L"ExchangeRate") |
| | | { |
| | | if (dw_goods.GetRowCount() > 0) |
| | | { |
| | | for (int i = 1; i <= dw_goods.GetRowCount(); i++) |
| | | { |
| | | dw_goods.SetItemDouble(i, "UnitProfit", EvalUnitProfit(i)); |
| | | dw_goods.SetItemDouble(i, "ProfitRate", EvalProfitRate(i)); |
| | | dw_goods.SetItemDouble(i, "SaleProfitRate", EvalSaleProfitRate(i)); |
| | | dw_goods.SetItemDouble(i, "ExchangeCostRate", EvalExchangeCostRate(i)); |
| | | dw_goods.SetItemDouble(i, L"UnitProfit", EvalUnitProfit(i)); |
| | | dw_goods.SetItemDouble(i, L"ProfitRate", EvalProfitRate(i)); |
| | | dw_goods.SetItemDouble(i, L"SaleProfitRate", EvalSaleProfitRate(i)); |
| | | dw_goods.SetItemDouble(i, L"ExchangeCostRate", EvalExchangeCostRate(i)); |
| | | } |
| | | } |
| | | dw_goods.Redraw(); |
| | |
| | | |
| | | int OnPriceEval() |
| | | { |
| | | OpenWindow("dev:xpage[eval.Enquiry3.vx]", cast(dw_goods as int)); |
| | | OpenWindow(L"dev:xpage[eval.Enquiry3.vx]", cast(dw_goods as int)); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnRowChanged(ref TNotifyEvent evt, int p) |
| | | int OnRowChanged(TEvent* evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | |
| | | imageview im = GetControl("im1"); |
| | | im.ResetEx(); |
| | | string skuno = dw_goods.GetItemString(row, "SKUNo"); |
| | | ximageview im = GetControl(L"im1"); |
| | | im.Reset(); |
| | | xstring skuno = dw_goods.GetItemString(row, L"SKUNo"); |
| | | OnShowImage(skuno, row); |
| | | im.Redraw(); |
| | | |
| | |
| | | int OnShowImage() |
| | | { |
| | | int rowCount = dw_goods.GetRowCount(); |
| | | string skunos; |
| | | xstring skunos; |
| | | for (int i = 1; i <= rowCount; i++) |
| | | { |
| | | string skuno = dw_goods.GetItemString(i, "SKUNo"); |
| | | xstring skuno = dw_goods.GetItemString(i, L"SKUNo"); |
| | | if (i == 1) |
| | | skunos = skuno; |
| | | else |
| | | skunos += "," + skuno; |
| | | skunos += L",L" + skuno; |
| | | } |
| | | |
| | | xaserverarg arg_pic = new xaserverarg; |
| | | arg_pic.setNativePointer(arg_pic.CreateInstance()); |
| | | arg_pic.AddArg("SKUNoList", skunos); |
| | | arg_pic.AddArg("ParentWindow", GetHWND().toString()); |
| | | arg_pic.AddArg("OpenFlag", "1"); |
| | | OpenWindow("dev:xpage[SKU.PictureView.Product3.vx]", cast(arg_pic as int)); |
| | | xaserverarg arg_pic; |
| | | |
| | | arg_pic.AddArg(L"SKUNoList", skunos); |
| | | arg_pic.AddArg(L"ParentWindow", GetHWND()); |
| | | arg_pic.AddArg(L"OpenFlag", L"1"); |
| | | OpenWindow(L"dev:xpage[SKU.PictureView.Product3.vx]",arg_pic); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnShowImage(string skuno, int row) |
| | | int OnShowImage(xstring skuno, int row) |
| | | { |
| | | imageview im = GetControl("im1"); |
| | | ximageview im = GetControl(L"im1"); |
| | | |
| | | xml xp = new xml; |
| | | xp.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg_pic = new xaserverarg; |
| | | xml xp ; |
| | | |
| | | xaserverarg arg_pic; |
| | | arg_pic.setNativePointer(arg_pic.CreateInstance()); |
| | | arg_pic.AddArg("SKUNo", skuno); |
| | | arg_pic.AddArg(L"SKUNo", skuno); |
| | | |
| | | string res = "/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo"; |
| | | string customerID = dw_base.GetItemString(1, "CustomerID"); |
| | | string customerItemNo = dw_goods.GetItemString(row, "CustomerItemNo"); |
| | | if (customerItemNo != "") |
| | | xstring res = L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo"; |
| | | xstring customerID = dw_base.GetItemString(1, L"CustomerID"); |
| | | xstring customerItemNo = dw_goods.GetItemString(row, L"CustomerItemNo"); |
| | | KXMLDOMNodeList nlistp; |
| | | int lenp = 0; |
| | | int ip = 0; |
| | | KXMLDOMElement xitem ; |
| | | xstring picname = L""; |
| | | xstring goodno = L""; |
| | | if (customerItemNo != L"") |
| | | { |
| | | //trace(customerID+":"+customerItemNo); |
| | | res = "/sale/data/ProductLibrary3/pref/picture/customer/imagelistSKUNo"; |
| | | arg_pic.AddArg("CustomerID", customerID); |
| | | arg_pic.AddArg("CustomerItemNo", customerItemNo); |
| | | //trace(customerID+L":"+customerItemNo); |
| | | res = L"/sale/data/ProductLibrary3/pref/picture/customer/imagelistSKUNo"; |
| | | arg_pic.AddArg(L"CustomerID", customerID); |
| | | arg_pic.AddArg(L"CustomerItemNo", customerItemNo); |
| | | } |
| | | |
| | | bool hasIamge = false; |
| | | if (url::get(res, arg_pic.GetString(), xp) != 1) |
| | | if (xurl::get(res, arg_pic.GetString(), xp) != 1) |
| | | { |
| | | //trace(xp.GetXml()); |
| | | //trace(xp.xml()); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | //trace(xp.GetXml()); |
| | | msxml::IXMLDOMNodeList nlistp = xp.GetXmlDoc().selectNodes("ImageList/image"); |
| | | int lenp = nlistp.length; |
| | | for (int ip = 0; ip < lenp; ip++) |
| | | //trace(xp.xml()); |
| | | nlistp = xp.selectNodes(L"ImageList/image"); |
| | | lenp = nlistp.length(); |
| | | for (ip = 0; ip < lenp; ip++) |
| | | { |
| | | hasIamge = true; |
| | | msxml::IXMLDOMElement xitem = nlistp.item(ip); |
| | | string picname = xitem.selectSingleNode("PicPath").text; |
| | | string goodno = xitem.selectSingleNode("GoodsNo").text; |
| | | if (picname == "/business/products/Thumbs//") |
| | | picname = "/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg"; |
| | | xitem = nlistp.item(ip); |
| | | picname = xitem.selectSingleNode(L"PicPath").text(); |
| | | goodno = xitem.selectSingleNode(L"GoodsNo").text(); |
| | | if (picname == L"/business/products/Thumbs//") |
| | | picname = L"/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg"; |
| | | im.AddImages(picname, goodno); |
| | | } |
| | | } |
| | | if (!hasIamge) |
| | | { |
| | | res = "/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo"; |
| | | if (url::get(res, arg_pic.GetString(), xp) != 1) |
| | | res = L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo"; |
| | | if (xurl::get(res, arg_pic.GetString(), xp) != 1) |
| | | { |
| | | //trace(xp.GetXml()); |
| | | //trace(xp.xml()); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | nlistp = xp.GetXmlDoc().selectNodes("ImageList/image"); |
| | | lenp = nlistp.length; |
| | | nlistp = xp.selectNodes(L"ImageList/image"); |
| | | lenp = nlistp.length(); |
| | | for (ip = 0; ip < lenp; ip++) |
| | | { |
| | | xitem = nlistp.item(ip); |
| | | picname = xitem.selectSingleNode("PicPath").text; |
| | | goodno = xitem.selectSingleNode("GoodsNo").text; |
| | | if (picname == "/business/products/Thumbs//") |
| | | picname = "/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg"; |
| | | picname = xitem.selectSingleNode(L"PicPath").text(); |
| | | goodno = xitem.selectSingleNode(L"GoodsNo").text(); |
| | | if (picname == L"/business/products/Thumbs//") |
| | | picname = L"/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg"; |
| | | im.AddImages(picname, goodno); |
| | | } |
| | | } |
| | |
| | | |
| | | int OnPrint() |
| | | { |
| | | if (dw_base.GetItemString(1, "EnquiryNo") == "") |
| | | if (dw_base.GetItemString(1, L"EnquiryNo") == L"") |
| | | { |
| | | alert("请先保存数据!"); |
| | | alert(L"请先保存数据!"); |
| | | return 1; |
| | | } |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("EntityName", "Enquiry", ""); |
| | | arg.AddArg("EntityID", dw_base.GetItemString(1, "EnquiryID"), ""); |
| | | arg.AddArg("EntityNo", dw_base.GetItemString(1, "EnquiryNo"), ""); |
| | | int p = arg.ptr_native_; |
| | | openUrl("/sale/view/view.base/xpage/Template/PrintViewEx", p); |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | arg.AddArg(L"EntityName", L"Enquiry", L""); |
| | | arg.AddArg(L"EntityID", dw_base.GetItemString(1, L"EnquiryID"), L""); |
| | | arg.AddArg(L"EntityNo", dw_base.GetItemString(1, L"EnquiryNo"), L""); |
| | | |
| | | openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", &arg); |
| | | return 1; |
| | | } |
| | | |
| | | int ReSeqNo(string SeqNoColumn) |
| | | int ReSeqNo(xstring SeqNoColumn) |
| | | { |
| | | for (int i = 1; i <= dw_goods.GetRowCount(); i++) |
| | | { |
| | | dw_goods.SetItemString(i, SeqNoColumn, (i * 10).toString()); |
| | | dw_goods.SetItemString(i, SeqNoColumn, xstring((i * 10))); |
| | | } |
| | | dw_goods.Redraw(); |
| | | return 1; |
| | |
| | | int OnAskGoodsNo() |
| | | { |
| | | int rowCount = dw_goods.GetRowCount(); |
| | | string skunos = ""; |
| | | xstring skunos = L""; |
| | | |
| | | for (int i = 1; i <= rowCount; i++) |
| | | { |
| | | if (dw_goods.GetItemString(i, "SKUNo") != "" && dw_goods.GetItemString(i, "GoodsNo") == "" && dw_goods.GetItemString(i, "Submitter") == "") |
| | | if (dw_goods.GetItemString(i, L"SKUNo") != L"" && dw_goods.GetItemString(i, L"GoodsNo") == L"" && dw_goods.GetItemString(i, L"Submitter") == L"") |
| | | { |
| | | if (skunos == "") |
| | | skunos = dw_goods.GetItemString(i, "SKUNo"); |
| | | if (skunos == L"") |
| | | skunos = dw_goods.GetItemString(i, L"SKUNo"); |
| | | else |
| | | skunos += "," + dw_goods.GetItemString(i, "SKUNo"); |
| | | skunos += L",L" + dw_goods.GetItemString(i, L"SKUNo"); |
| | | } |
| | | } |
| | | xaserverarg arg = ViewObject::MakeArg(); |
| | | arg.AddArg("SKUNoList", skunos); |
| | | OpenWindow("dev:xpage[Product.FetchNo.vx]", cast(arg as int)); |
| | | xaserverarg arg ; |
| | | arg.AddArg(L"SKUNoList", skunos); |
| | | OpenWindow(L"dev:xpage[Product.FetchNo.vx]",arg ); |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == "xmNewProduct") |
| | | if (comdid == L"xmNewProduct") |
| | | { |
| | | //xaserverarg arg = new xaserverarg; |
| | | //arg.setNativePointer(arg.CreateInstance()); |
| | | openUrl("/sale/view/Enquiry3/xpage/quick/newestproduct", GetHWND()); |
| | | //xaserverarg arg; |
| | | // |
| | | openUrl(L"/sale/view/Enquiry3/xpage/quick/newestproduct"); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmPrint") return OnPrint(); |
| | | else if (comdid == "xmImage") |
| | | else if (comdid == L"xmPrint") return OnPrint(); |
| | | else if (comdid == L"xmImage") |
| | | return OnShowImage(); |
| | | else if (comdid == "xmShare") |
| | | else if (comdid == L"xmShare") |
| | | return OnShare(); |
| | | else if (comdid == "xmImportProduct") |
| | | else if (comdid == L"xmImportProduct") |
| | | { |
| | | string str = GetControl("goods").GetText(); |
| | | xstring str = xcontrol(GetControl(L"goods")).GetText(); |
| | | str = str.trim(); |
| | | if (str == "") |
| | | if (str == L"") |
| | | { |
| | | xaserverarg arg1 = new xaserverarg; |
| | | xaserverarg arg1; |
| | | arg1.setNativePointer(arg1.CreateInstance()); |
| | | arg1.AddArg("HWND", GetHWND().toString()); |
| | | arg1.AddArg("CustomerID", dw_base.GetItemString(1, "CustomerID")); |
| | | OpenWindow("dev:xpage[Entity.Product.Select.vx]", cast(arg1 as int)); |
| | | arg1.AddArg(L"HWND", GetHWND().toString()); |
| | | arg1.AddArg(L"CustomerID", dw_base.GetItemString(1, L"CustomerID")); |
| | | OpenWindow(L"dev:xpage[Entity.Product.Select.vx]",arg1); |
| | | int row = dw_goods.GetRow(); |
| | | if (row >= 1) |
| | | { |
| | | imageview im = GetControl("im1"); |
| | | im.ResetEx(); |
| | | string skuno = dw_goods.GetItemString(row, "SKUNo"); |
| | | ximageview im = GetControl(L"im1"); |
| | | im.Reset(); |
| | | xstring skuno = dw_goods.GetItemString(row, L"SKUNo"); |
| | | OnShowImage(skuno, row); |
| | | im.Redraw(); |
| | | } |
| | |
| | | ImportProductByText(str); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmSave") |
| | | else if (comdid == L"xmSave") |
| | | { |
| | | OnSave(); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmPriceEval") |
| | | else if (comdid == L"xmPriceEval") |
| | | return OnPriceEval(); |
| | | else if (comdid == "xmOpen") |
| | | else if (comdid == L"xmOpen") |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | OpenWindow("dev:xpage[SOEnquiry.list.vx]", cast(arg as int)); |
| | | if (arg.GetArgString("id") != "") return OnRetrieve(arg.GetArgString("id")); |
| | | xaserverarg arg; |
| | | |
| | | OpenWindow(L"dev:xpage[SOEnquiry.list.vx]",arg); |
| | | if (arg.GetArgString(L"id") != L"") return OnRetrieve(arg.GetArgString(L"id")); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmDeleteRow") |
| | | else if (comdid == L"xmDeleteRow") |
| | | { |
| | | if (dw_goods.GetItemString(dw_goods.GetRow(), "QuoteNo") != "") |
| | | if (dw_goods.GetItemString(dw_goods.GetRow(), L"QuoteNo") != L"") |
| | | { |
| | | alert("产品已被应用,不能删除"); |
| | | alert(L"产品已被应用,不能删除"); |
| | | return 1; |
| | | } |
| | | dw_goods.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmBOMSchema") |
| | | else if (comdid == L"xmBOMSchema") |
| | | { |
| | | OpenWindow("dev:xpage[ProductSchema.vx]", 0); |
| | | OpenWindow(L"dev:xpage[ProductSchema.vx]", 0); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmProductDesc") |
| | | else if (comdid == L"xmProductDesc") |
| | | { |
| | | xaserverarg arg2 = new xaserverarg; |
| | | arg2.setNativePointer(arg2.CreateInstance()); |
| | | xaserverarg arg2; |
| | | |
| | | int row2 = dw_goods.GetRow(); |
| | | if (row2 < 1) return 0; |
| | | string str2 = dw_goods.GetItemString(row2, "ProductDesc"); |
| | | arg2.AddArg("value", str2); |
| | | OpenWindow("dev:xpage[memo.edit.new.vx]", arg2.getNativePointer()); |
| | | if (arg2.GetArgString("comdid") == "xmOK") |
| | | xstring str2 = dw_goods.GetItemString(row2, L"ProductDesc"); |
| | | arg2.AddArg(L"value", str2); |
| | | OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg2); |
| | | if (arg2.GetArgString(L"comdid") == L"xmOK") |
| | | { |
| | | str2 = arg2.GetArgString("value"); |
| | | str2 = arg2.GetArgString(L"value"); |
| | | dw_goods.AcceptText(); |
| | | dw_goods.SetItemString(row2, "ProductDesc", str2); |
| | | dw_goods.SetItemString(row2, L"ProductDesc", str2); |
| | | dw_goods.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmReSeqNo") |
| | | else if (comdid == L"xmReSeqNo") |
| | | { |
| | | if (win32::MessageBox(GetHWND(), "是否重置序号!", "提示1", 1) == 2) |
| | | if (MessageBox(GetHWND(), L"是否重置序号!", L"提示1", 1) == 2) |
| | | return 1; |
| | | return ReSeqNo("SeqNo"); |
| | | return ReSeqNo(L"SeqNo"); |
| | | } |
| | | else if (comdid == "xmAddRow") |
| | | else if (comdid == L"xmAddRow") |
| | | { |
| | | int nRow = dw_goods.InsertRow(0); |
| | | SetSeqNo(dw_goods, "SeqNo", nRow); |
| | | dw_goods.SetItemString(nRow, "UOMCode", "007"); |
| | | dw_goods.SetItemDisplayString(nRow, "UOMCode", "PCS"); |
| | | dw_goods.SetItemString(nRow, "KOPCode", "120"); |
| | | dw_goods.SetItemDisplayString(nRow, "KOPCode", "CTNS"); |
| | | SetSeqNo(dw_goods, L"SeqNo", nRow); |
| | | dw_goods.SetItemString(nRow, L"UOMCode", L"007"); |
| | | dw_goods.SetItemDisplayString(nRow, L"UOMCode", L"PCS"); |
| | | dw_goods.SetItemString(nRow, L"KOPCode", L"120"); |
| | | dw_goods.SetItemDisplayString(nRow, L"KOPCode", L"CTNS"); |
| | | |
| | | xaserverarg arg3 = new xaserverarg; |
| | | xaserverarg arg3; |
| | | arg3.setNativePointer(arg3.CreateInstance()); |
| | | int row3 = dw_goods.GetRow(); |
| | | if (row3 < 1) return 0; |
| | | dw_goods.SetItemString(nRow, "SKUNo", dw_goods.GetItemString(row3, "SKUNo")); |
| | | dw_goods.SetItemString(nRow, "ItemID", dw_goods.GetItemString(row3, "ItemID")); |
| | | dw_goods.SetItemString(nRow, L"SKUNo", dw_goods.GetItemString(row3, L"SKUNo")); |
| | | dw_goods.SetItemString(nRow, L"ItemID", dw_goods.GetItemString(row3, L"ItemID")); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmClose") |
| | | else if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid.find("ImportXml:", 0) == 0) |
| | | else if (comdid.find(L"ImportXml:", 0) == 0) |
| | | { |
| | | string strImport = comdid.mid("ImportXml:".length(), 9999); |
| | | xstring strImport = comdid.mid(L"ImportXml:".length(), 9999); |
| | | |
| | | ImportProductByText(strImport); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmAskGoodsNo") |
| | | else if (comdid == L"xmAskGoodsNo") |
| | | { |
| | | return OnAskGoodsNo(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnImgDBClicked(ref TNotifyEvent evt, int pr) |
| | | int OnImgDBClicked(TEvent* evt, int pr) |
| | | { |
| | | ref IMGNNMHDR nmtv = evt.pnmh; |
| | | string src = nmtv.path; |
| | | IMGNNMHDR& nmtv = *(IMGNNMHDR*)evt->notify.pnmh; |
| | | xstring src = nmtv.path; |
| | | /*if(src.length() > 60) |
| | | src = src.right(44); |
| | | else |
| | | src=src.mid(src.find("Thumbs", 0)+6, 50); |
| | | src=src.mid(src.find(L"Thumbs", 0)+6, 50); |
| | | */ |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | //arg.AddArg("src","/business/products/chanpin"+src); |
| | | arg.AddArg("src", src); |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | //arg.AddArg(L"src",L"/business/products/chanpin"+src); |
| | | arg.AddArg(L"src", src); |
| | | |
| | | //win::OpenWindow("dev:xpage[BigPicture.vx]",arg); |
| | | //win::OpenWindow(L"dev:xpage[BigPicture.vx]",arg); |
| | | |
| | | int h = openUrl("/sale/view/ProductLibrary/xpage/bigpictureview", arg); |
| | | int h = openUrl(L"/sale/view/ProductLibrary/xpage/bigpictureview", &arg); |
| | | return 1; |
| | | /* |
| | | xwin x = new xwin; |
| | | x.setNativePointer(h); |
| | | m_winHwnd = x.GetHWND(); |
| | | |
| | | string sh = doc.GetXml(); |
| | | xstring sh = doc.xml(); |
| | | int p = cast(sh as int); |
| | | win32::SendMessage(m_winHwnd, 0x401, p, 0); |
| | | */ |
| | |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt, int param) |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnItemAskStyle(ref TNotifyEvent evt, int p) |
| | | int OnItemAskStyle(TEvent* evt, int p) |
| | | { |
| | | DWASKSTYLENMHDR& hdr = *(DWASKSTYLENMHDR*)evt->notify.pnmh; |
| | | int DMS_CSSSTYLE = 0x8; |
| | | ref DWASKSTYLENMHDR hdr = trust(evt.pnmh as ref DWASKSTYLENMHDR); |
| | | int row = hdr.row; |
| | | int col = hdr.col; |
| | | string colname = hdr.colname; |
| | | xstring colname = hdr.colname; |
| | | |
| | | int rows = dw_goods.GetRowCount(); |
| | | if (row < 1 || row > rows) |
| | | { |
| | | return 1; |
| | | } |
| | | if (colname == "POPrice") |
| | | if (colname == L"POPrice") |
| | | { |
| | | if (dw_goods.GetItemTipString(row, colname) != "") |
| | | if (dw_goods.GetItemTipString(row, colname) != L"") |
| | | { |
| | | hdr.mask = DMS_CSSSTYLE; |
| | | hdr.cssstyle = "color:#cc0000"; |
| | | hdr.pCssStyle = (LPTSTR)L"color:#cc0000"; |
| | | } |
| | | } |
| | | return 1; |
| | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&EnquiryMaintView::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | AttachEvent("dw_goods", "DWV_ITEMCHANGED", OnItemChanged); |
| | | AttachEvent("dw_base", "DWV_ITEMCHANGED", OnBaseItemChanged); |
| | | AttachEvent("im1", "IMG_LDBCLICK", OnImgDBClicked); |
| | | AttachEvent("dw_goods", "DWV_ROWFOCUSCHANGED", OnRowChanged); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&EnquiryMaintView::OnSetFocus); |
| | | AttachEvent(L"dw_goods", L"DWV_ITEMCHANGED", (FEvent)&EnquiryMaintView::OnItemChanged); |
| | | AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&EnquiryMaintView::OnBaseItemChanged); |
| | | AttachEvent(L"im1", L"IMG_LDBCLICK", (FEvent)&EnquiryMaintView::OnImgDBClicked); |
| | | AttachEvent(L"dw_goods", L"DWV_ROWFOCUSCHANGED", (FEvent)&EnquiryMaintView::OnRowChanged); |
| | | AttachCloseWindow(); |
| | | AttachEvent("dw_goods", "DWV_ASKSTYLE", OnItemAskStyle); |
| | | AttachEvent(L"dw_goods", L"DWV_ASKSTYLE", (FEvent)&EnquiryMaintView::OnItemAskStyle); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(string id) |
| | | int OnRetrieve(xstring id) |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id", id); |
| | | if (getUrl("/sale/data/Enquiry/maint", arg.GetString(), x) != 1) |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"id", id); |
| | | if (getUrl(L"/sale/data/Enquiry/maint", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.GetXmlDoc().text); |
| | | alert(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | //alert(x.GetXml()); |
| | | //alert(x.xml()); |
| | | dw_base.Retrieve(x); |
| | | dw_goods.Retrieve(x); |
| | | dw_base.Redraw(); |
| | |
| | | |
| | | if (dw_goods.GetRowCount() > 0) |
| | | { |
| | | imageview im = GetControl("im1"); |
| | | im.ResetEx(); |
| | | string skuno = dw_goods.GetItemString(1, "SKUNo"); |
| | | ximageview im = GetControl(L"im1"); |
| | | im.Reset(); |
| | | xstring skuno = dw_goods.GetItemString(1, L"SKUNo"); |
| | | OnShowImage(skuno, 1); |
| | | im.Redraw(); |
| | | } |
| | | |
| | | //x.LoadXml("<Enquiry/>"); |
| | | //x.LoadXml(L"<Enquiry/>"); |
| | | //dw_base.RetrieveDiff(x); |
| | | //dw_goods.RetrieveDiff(x); |
| | | |
| | | //dw_goods.SetItemTipString(1,"POPrice","21.4 2018/07/08\r\n23.4 2018/07/12"); |
| | | //dw_goods.SetItemTipString(1,L"POPrice",L"21.4 2018/07/08\r\n23.4 2018/07/12"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int Oncopy(string EnquiryID, string ItemID) |
| | | int Oncopy(xstring EnquiryID, xstring ItemID) |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(GetParam()); |
| | | xaserverarg arg; |
| | | |
| | | |
| | | |
| | | dw_base.SetItemString(1, "ValidDay", arg.GetArgString("ValidDay")); |
| | | dw_base.SetItemString(1, "SONo", arg.GetArgString("SONo")); |
| | | dw_base.SetItemString(1, "Remark", arg.GetArgString("Remark")); |
| | | dw_base.SetItemString(1, "Source", arg.GetArgString("Source")); |
| | | dw_base.SetItemString(1, "PayTerm", arg.GetArgString("PayTerm")); |
| | | dw_base.SetItemString(1, "SupplierID", arg.GetArgString("SupplierID")); |
| | | dw_base.SetItemDisplayString(1, "SupplierID", arg.GetArgString("SupplierID/@_displaystring")); |
| | | dw_base.SetItemString(1, "CustomerContactName", arg.GetArgString("CustomerContactName")); |
| | | dw_base.SetItemString(1, "ContactTel", arg.GetArgString("ContactTel")); |
| | | dw_base.SetItemString(1, L"ValidDay", arg.GetArgString(L"ValidDay")); |
| | | dw_base.SetItemString(1, L"SONo", arg.GetArgString(L"SONo")); |
| | | dw_base.SetItemString(1, L"Remark", arg.GetArgString(L"Remark")); |
| | | dw_base.SetItemString(1, L"Source", arg.GetArgString(L"Source")); |
| | | dw_base.SetItemString(1, L"PayTerm", arg.GetArgString(L"PayTerm")); |
| | | dw_base.SetItemString(1, L"SupplierID", arg.GetArgString(L"SupplierID")); |
| | | dw_base.SetItemDisplayString(1, L"SupplierID", arg.GetArgString(L"SupplierID/@_displaystring")); |
| | | dw_base.SetItemString(1, L"CustomerContactName", arg.GetArgString(L"CustomerContactName")); |
| | | dw_base.SetItemString(1, L"ContactTel", arg.GetArgString(L"ContactTel")); |
| | | |
| | | string sdate = publiccode::GetCurrentDate(); |
| | | dw_base.SetItemString(1, "EnquiryDate", sdate); |
| | | string suserid = publiccode::GetUser().id; |
| | | string susername = publiccode::GetUser().name; |
| | | dw_base.SetItemString(1, "SalespersonID", suserid); |
| | | dw_base.SetItemDisplayString(1, "SalespersonID", susername); |
| | | dw_base.SetItemString(1, "CompanyID", "E9E3C542-062C-4957-B8F4-9B92C3E351FC"); |
| | | dw_base.SetItemDisplayString(1, "CompanyID", "宁波家尔佳进出口有限公司"); |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_base.SetItemString(1, L"EnquiryDate", sdate); |
| | | xstring suserid = publiccode::GetUser().id; |
| | | xstring susername = publiccode::GetUser().name; |
| | | dw_base.SetItemString(1, L"SalespersonID", suserid); |
| | | dw_base.SetItemDisplayString(1, L"SalespersonID", susername); |
| | | dw_base.SetItemString(1, L"CompanyID", L"E9E3C542-062C-4957-B8F4-9B92C3E351FC"); |
| | | dw_base.SetItemDisplayString(1, L"CompanyID", L"宁波家尔佳进出口有限公司"); |
| | | |
| | | //xml x = QuoteView::Oncopy(EnquiryID,ItemID); |
| | | |
| | | xml x = ViewObject::RetrieveData("/sale/data/Enquiry/Oncopy", "EnquiryID", EnquiryID, "ItemID", ItemID); |
| | | xml x = ViewObject::RetrieveData(L"/sale/data/Enquiry/Oncopy", L"EnquiryID", EnquiryID, L"ItemID", ItemID); |
| | | if (!x) return 1; |
| | | //alert(x.GetXml()); |
| | | msxml::IXMLDOMNodeList items = x.GetXmlDoc().selectNodes("/Enquiry/Item"); |
| | | int len = items.length; |
| | | //alert(x.xml()); |
| | | KXMLDOMNodeList items = x.selectNodes(L"/Enquiry/Item"); |
| | | int len = items.length(); |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | |
| | | msxml::IXMLDOMElement e = items.item(i); |
| | | KXMLDOMElement e = items.item(i); |
| | | dw_goods.InsertRow(i); |
| | | |
| | | int nRow = dw_goods.GetRow(); |
| | | |
| | | SetSeqNo(dw_goods, "SeqNo", nRow); |
| | | dw_goods.SetItemString(nRow, "UOMCode", "007"); |
| | | dw_goods.SetItemDisplayString(nRow, "UOMCode", "PCS"); |
| | | dw_goods.SetItemString(nRow, "KOPCode", "120"); |
| | | dw_goods.SetItemDisplayString(nRow, "KOPCode", "CTNS"); |
| | | if (e.selectSingleNode("ItemName"))dw_goods.SetItemString(nRow, "ItemName", e.selectSingleNode("ItemName").text); |
| | | if (e.selectSingleNode("GoodsNo"))dw_goods.SetItemString(nRow, "GoodsNo", e.selectSingleNode("GoodsNo").text); |
| | | if (e.selectSingleNode("SKUNo"))dw_goods.SetItemString(nRow, "SKUNo", e.selectSingleNode("SKUNo").text); |
| | | if (e.selectSingleNode("ItemMiniQty"))dw_goods.SetItemString(nRow, "ItemMiniQty", e.selectSingleNode("ItemMiniQty").text); |
| | | if (e.selectSingleNode("Picture"))dw_goods.SetItemString(nRow, "Picture", e.selectSingleNode("Picture").text); |
| | | if (e.selectSingleNode("ItemID"))dw_goods.SetItemString(nRow, "ItemID", e.selectSingleNode("ItemID").text); |
| | | if (e.selectSingleNode("ProductDesc"))dw_goods.SetItemString(nRow, "ProductDesc", e.selectSingleNode("ProductDesc").text); |
| | | if (e.selectSingleNode("Packing"))dw_goods.SetItemString(nRow, "Packing", e.selectSingleNode("Packing").text); |
| | | if (e.selectSingleNode("POPrice"))dw_goods.SetItemString(nRow, "POPrice", e.selectSingleNode("POPrice").text); |
| | | if (e.selectSingleNode("PriceType"))dw_goods.SetItemString(nRow, "PriceType", e.selectSingleNode("PriceType").text); |
| | | if (e.selectSingleNode("InnerQty"))dw_goods.SetItemString(nRow, "InnerQty", e.selectSingleNode("InnerQty").text); |
| | | if (e.selectSingleNode("PackingRate"))dw_goods.SetItemString(nRow, "PackingRate", e.selectSingleNode("PackingRate").text); |
| | | if (e.selectSingleNode("VolumeDesc"))dw_goods.SetItemString(nRow, "VolumeDesc", e.selectSingleNode("VolumeDesc").text); |
| | | if (e.selectSingleNode("SampleFee"))dw_goods.SetItemString(nRow, "SampleFee", e.selectSingleNode("SampleFee").text); |
| | | if (e.selectSingleNode("TestFee"))dw_goods.SetItemString(nRow, "TestFee", e.selectSingleNode("TestFee").text); |
| | | if (e.selectSingleNode("ModelFee"))dw_goods.SetItemString(nRow, "ModelFee", e.selectSingleNode("ModelFee").text); |
| | | if (e.selectSingleNode("BOMPartNo"))dw_goods.SetItemString(nRow, "BOMPartNo", e.selectSingleNode("BOMPartNo").text); |
| | | if (e.selectSingleNode("ModifyDate"))dw_goods.SetItemString(nRow, "ModifyDate", e.selectSingleNode("ModifyDate").text); |
| | | SetSeqNo(dw_goods, L"SeqNo", nRow); |
| | | dw_goods.SetItemString(nRow, L"UOMCode", L"007"); |
| | | dw_goods.SetItemDisplayString(nRow, L"UOMCode", L"PCS"); |
| | | dw_goods.SetItemString(nRow, L"KOPCode", L"120"); |
| | | dw_goods.SetItemDisplayString(nRow, L"KOPCode", L"CTNS"); |
| | | if (e.selectSingleNode(L"ItemName"))dw_goods.SetItemString(nRow, L"ItemName", e.selectSingleNode(L"ItemName").text()); |
| | | if (e.selectSingleNode(L"GoodsNo"))dw_goods.SetItemString(nRow, L"GoodsNo", e.selectSingleNode(L"GoodsNo").text()); |
| | | if (e.selectSingleNode(L"SKUNo"))dw_goods.SetItemString(nRow, L"SKUNo", e.selectSingleNode(L"SKUNo").text()); |
| | | if (e.selectSingleNode(L"ItemMiniQty"))dw_goods.SetItemString(nRow, L"ItemMiniQty", e.selectSingleNode(L"ItemMiniQty").text()); |
| | | if (e.selectSingleNode(L"Picture"))dw_goods.SetItemString(nRow, L"Picture", e.selectSingleNode(L"Picture").text()); |
| | | if (e.selectSingleNode(L"ItemID"))dw_goods.SetItemString(nRow, L"ItemID", e.selectSingleNode(L"ItemID").text()); |
| | | if (e.selectSingleNode(L"ProductDesc"))dw_goods.SetItemString(nRow, L"ProductDesc", e.selectSingleNode(L"ProductDesc").text()); |
| | | if (e.selectSingleNode(L"Packing"))dw_goods.SetItemString(nRow, L"Packing", e.selectSingleNode(L"Packing").text()); |
| | | if (e.selectSingleNode(L"POPrice"))dw_goods.SetItemString(nRow, L"POPrice", e.selectSingleNode(L"POPrice").text()); |
| | | if (e.selectSingleNode(L"PriceType"))dw_goods.SetItemString(nRow, L"PriceType", e.selectSingleNode(L"PriceType").text()); |
| | | if (e.selectSingleNode(L"InnerQty"))dw_goods.SetItemString(nRow, L"InnerQty", e.selectSingleNode(L"InnerQty").text()); |
| | | if (e.selectSingleNode(L"PackingRate"))dw_goods.SetItemString(nRow, L"PackingRate", e.selectSingleNode(L"PackingRate").text()); |
| | | if (e.selectSingleNode(L"VolumeDesc"))dw_goods.SetItemString(nRow, L"VolumeDesc", e.selectSingleNode(L"VolumeDesc").text()); |
| | | if (e.selectSingleNode(L"SampleFee"))dw_goods.SetItemString(nRow, L"SampleFee", e.selectSingleNode(L"SampleFee").text()); |
| | | if (e.selectSingleNode(L"TestFee"))dw_goods.SetItemString(nRow, L"TestFee", e.selectSingleNode(L"TestFee").text()); |
| | | if (e.selectSingleNode(L"ModelFee"))dw_goods.SetItemString(nRow, L"ModelFee", e.selectSingleNode(L"ModelFee").text()); |
| | | if (e.selectSingleNode(L"BOMPartNo"))dw_goods.SetItemString(nRow, L"BOMPartNo", e.selectSingleNode(L"BOMPartNo").text()); |
| | | if (e.selectSingleNode(L"ModifyDate"))dw_goods.SetItemString(nRow, L"ModifyDate", e.selectSingleNode(L"ModifyDate").text()); |
| | | |
| | | if (e.selectSingleNode("EnquiryDate"))dw_goods.SetItemString(nRow, "EnquiryDate", e.selectSingleNode("EnquiryDate").text); |
| | | if (e.selectSingleNode("EnquiryPriceListID"))dw_goods.SetItemString(nRow, "EnquiryPriceListID", e.selectSingleNode("EnquiryPriceListID").text); |
| | | if (e.selectSingleNode("RelEnquiryLineID"))dw_goods.SetItemString(nRow, "RelEnquiryLineID", e.selectSingleNode("RelEnquiryLineID").text); |
| | | if (e.selectSingleNode("PirorEnquiryLineID"))dw_goods.SetItemString(nRow, "PirorEnquiryLineID", e.selectSingleNode("PirorEnquiryLineID").text); |
| | | if (e.selectSingleNode("RealEnquiryLineID"))dw_goods.SetItemString(nRow, "RealEnquiryLineID", e.selectSingleNode("RealEnquiryLineID").text); |
| | | if (e.selectSingleNode("category"))dw_goods.SetItemString(nRow, "category", e.selectSingleNode("category").text); |
| | | if (e.selectSingleNode(L"EnquiryDate"))dw_goods.SetItemString(nRow, L"EnquiryDate", e.selectSingleNode(L"EnquiryDate").text()); |
| | | if (e.selectSingleNode(L"EnquiryPriceListID"))dw_goods.SetItemString(nRow, L"EnquiryPriceListID", e.selectSingleNode(L"EnquiryPriceListID").text()); |
| | | if (e.selectSingleNode(L"RelEnquiryLineID"))dw_goods.SetItemString(nRow, L"RelEnquiryLineID", e.selectSingleNode(L"RelEnquiryLineID").text()); |
| | | if (e.selectSingleNode(L"PirorEnquiryLineID"))dw_goods.SetItemString(nRow, L"PirorEnquiryLineID", e.selectSingleNode(L"PirorEnquiryLineID").text()); |
| | | if (e.selectSingleNode(L"RealEnquiryLineID"))dw_goods.SetItemString(nRow, L"RealEnquiryLineID", e.selectSingleNode(L"RealEnquiryLineID").text()); |
| | | if (e.selectSingleNode(L"category"))dw_goods.SetItemString(nRow, L"category", e.selectSingleNode(L"category").text()); |
| | | |
| | | |
| | | if (dw_goods.GetItemString(nRow, "VolumeDesc") != "" && |
| | | dw_goods.GetItemString(nRow, "Packages") != "") |
| | | if (dw_goods.GetItemString(nRow, L"VolumeDesc") != L"" && |
| | | dw_goods.GetItemString(nRow, L"Packages") != L"") |
| | | { |
| | | int qty = EvalQtyPerFCL45H(nRow); |
| | | dw_goods.SetItemString(nRow, "Packages45H", qty.toString()); |
| | | dw_goods.SetItemDouble(nRow, "TransportationFee", 5000.0 / qty); |
| | | dw_goods.SetItemString(nRow, L"Packages45H", xstring(qty)); |
| | | dw_goods.SetItemDouble(nRow, L"TransportationFee", 5000.0 / qty); |
| | | } |
| | | |
| | | } |
| | |
| | | int OnInit() |
| | | { |
| | | //公司抬头、报价人、报价日期 |
| | | string sdate = publiccode::GetCurrentDate(); |
| | | dw_base.SetItemString(1, "EnquiryDate", sdate); |
| | | string suserid = publiccode::GetUser().id; |
| | | string susername = publiccode::GetUser().name; |
| | | dw_base.SetItemString(1, "SalespersonID", suserid); |
| | | dw_base.SetItemDisplayString(1, "SalespersonID", susername); |
| | | dw_base.SetItemString(1, "CompanyID", "E9E3C542-062C-4957-B8F4-9B92C3E351FC"); |
| | | dw_base.SetItemDisplayString(1, "CompanyID", "宁波家尔佳进出口有限公司"); |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_base.SetItemString(1, L"EnquiryDate", sdate); |
| | | xstring suserid = publiccode::GetUser().id; |
| | | xstring susername = publiccode::GetUser().name; |
| | | dw_base.SetItemString(1, L"SalespersonID", suserid); |
| | | dw_base.SetItemDisplayString(1, L"SalespersonID", susername); |
| | | dw_base.SetItemString(1, L"CompanyID", L"E9E3C542-062C-4957-B8F4-9B92C3E351FC"); |
| | | dw_base.SetItemDisplayString(1, L"CompanyID", L"宁波家尔佳进出口有限公司"); |
| | | return 1; |
| | | } |
| | | |
| | | /* |
| | | pricebill: one of enquiry pricebill quote pricebill |
| | | */ |
| | | int RetrieveItemList(string items, string pricebill = "") |
| | | int RetrieveItemList(xstring items, xstring pricebill = L"") |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("ItemList", items); |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"ItemList", items); |
| | | //alert(items); |
| | | string dataurl = "/sale/data/Enquiry/maint/items"; |
| | | if (pricebill == "pricebill") dataurl = "/sale/data/Enquiry/maint/pricelist/items"; |
| | | if (pricebill == "quote") dataurl = "/sale/data/Enquiry/FetchItemListByQuoteItemID"; |
| | | xstring dataurl = L"/sale/data/Enquiry/maint/items"; |
| | | if (pricebill == L"pricebill") dataurl = L"/sale/data/Enquiry/maint/pricelist/items"; |
| | | if (pricebill == L"quote") dataurl = L"/sale/data/Enquiry/FetchItemListByQuoteItemID"; |
| | | if (getUrl(dataurl, arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.GetXmlDoc().text); |
| | | alert(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | |
| | | trace("*****" + x.GetXml() + "*****"); |
| | | //trace(L"*****" + x.xml() + L"*****"); |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | ReSeqNo("SeqNo"); |
| | | ReSeqNo(L"SeqNo"); |
| | | |
| | | |
| | | if (dw_goods.GetRowCount() > 0) |
| | | { |
| | | if (dw_goods.GetItemString(1, "customerno")) |
| | | if (dw_goods.GetItemString(1, L"customerno")) |
| | | { |
| | | dw_base.SetItemString(1, "CustomerNo", dw_goods.GetItemString(1, "customerno")); |
| | | dw_base.SetItemString(1, L"CustomerNo", dw_goods.GetItemString(1, L"customerno")); |
| | | } |
| | | imageview im = GetControl("im1"); |
| | | im.ResetEx(); |
| | | string skuno = dw_goods.GetItemString(1, "SKUNo"); |
| | | ximageview im = GetControl(L"im1"); |
| | | im.Reset(); |
| | | xstring skuno = dw_goods.GetItemString(1, L"SKUNo"); |
| | | OnShowImage(skuno, 1); |
| | | im.Redraw(); |
| | | } |
| | |
| | | |
| | | int onload() |
| | | { |
| | | dw_goods = GetControl("dw_goods"); |
| | | //dw_goods .openUrl("/sale/view/Enquiry3/template/goods"); |
| | | dw_goods.openUrl("/sale/view/Enquiry3/template/item/pricelist"); |
| | | dw_goods.SetColumnState("ItemID", false); |
| | | //dw_goods.SetColumnState("Picture",false); |
| | | dw_goods.SetColumnState("category", false); |
| | | dw_goods.SetColumnState("RealEnquiryLineID", false); |
| | | dw_goods.SetColumnState("RelEnquiryLineID", false); |
| | | dw_goods.SetColumnState("BOMPartNo", false); |
| | | SetArg(); |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | //dw_goods .openUrl(L"/sale/view/Enquiry3/template/goods"); |
| | | dw_goods.openUrl(L"/sale/view/Enquiry3/template/item/pricelist"); |
| | | dw_goods.SetColumnState(L"ItemID", false); |
| | | //dw_goods.SetColumnState(L"Picture",false); |
| | | dw_goods.SetColumnState(L"category", false); |
| | | dw_goods.SetColumnState(L"RealEnquiryLineID", false); |
| | | dw_goods.SetColumnState(L"RelEnquiryLineID", false); |
| | | dw_goods.SetColumnState(L"BOMPartNo", false); |
| | | |
| | | dw_base = GetControl("dw_base"); |
| | | dw_base = GetControl(L"dw_base"); |
| | | |
| | | if (GetParam()) |
| | | if (GetWinParam()) |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(GetParam()); |
| | | xaserverarg arg=GetArg(); |
| | | |
| | | |
| | | sheetname = arg.GetArgString("sheetname"); |
| | | if (sheetname == "tab_list2") |
| | | sheetname = arg.GetArgString(L"sheetname"); |
| | | if (sheetname == L"tab_list2") |
| | | { |
| | | dw_base.openUrl("/sale/view/Enquiry3/template/base2"); |
| | | //dw_base.SetItemString(1,"Source","客户询价"); |
| | | dw_goods.SetColumnState("SupplierID", true); |
| | | dw_base.openUrl(L"/sale/view/Enquiry3/template/base2"); |
| | | //dw_base.SetItemString(1,L"Source",L"客户询价"); |
| | | dw_goods.SetColumnState(L"SupplierID", true); |
| | | } |
| | | else |
| | | { |
| | | |
| | | dw_base.openUrl("/sale/view/Enquiry3/template/base"); |
| | | //dw_base.SetItemString(1,"Source","客户询价"); |
| | | dw_goods.SetColumnState("SupplierID", false); |
| | | dw_base.openUrl(L"/sale/view/Enquiry3/template/base"); |
| | | //dw_base.SetItemString(1,L"Source",L"客户询价"); |
| | | dw_goods.SetColumnState(L"SupplierID", false); |
| | | } |
| | | dw_base.SetColHeaderHeight(0); |
| | | dw_base.SetRowSelectorWidth(0); |
| | | dw_base.SetHScrollState(false); |
| | | dw_base.SetVScrollState(false); |
| | | |
| | | string EnquiryNo = arg.GetArgString("EnquiryNo"); |
| | | string EnquiryID = arg.GetArgString("EnquiryID"); |
| | | string ItemID = arg.GetArgString("ItemID"); |
| | | if (EnquiryNo == "") EnquiryNo = arg.GetArgString("EntityNo"); |
| | | if (EnquiryNo != "") |
| | | xstring EnquiryNo = arg.GetArgString(L"EnquiryNo"); |
| | | xstring EnquiryID = arg.GetArgString(L"EnquiryID"); |
| | | xstring ItemID = arg.GetArgString(L"ItemID"); |
| | | if (EnquiryNo == L"") EnquiryNo = arg.GetArgString(L"EntityNo"); |
| | | if (EnquiryNo != L"") |
| | | { |
| | | OnRetrieve(EnquiryNo); |
| | | |
| | | } |
| | | else if (EnquiryID != "") { |
| | | else if (EnquiryID != L"") { |
| | | Oncopy(EnquiryID, ItemID); |
| | | } |
| | | else |
| | | { |
| | | OnInit(); |
| | | |
| | | if (arg.GetArgString("CustomerID") != "") |
| | | if (arg.GetArgString(L"CustomerID") != L"") |
| | | { |
| | | dw_base.SetItemDisplayString(1, "SupplierID", arg.GetArgString("CustomerName")); |
| | | dw_base.ItemChangeTo(1, "SupplierID", arg.GetArgString("CustomerID")); |
| | | string dwname = "dw_base"; |
| | | string colname = "SupplierID"; |
| | | string value = arg.GetArgString("CustomerID"); |
| | | msxml::IXMLDOMNodeList nlist = GetElement().selectNodes("//*[@name='" + dwname + "']/trans[@for='" + colname + "']"); |
| | | dw_base.SetItemDisplayString(1, L"SupplierID", arg.GetArgString(L"CustomerName")); |
| | | dw_base.ItemChangeTo(1, L"SupplierID", arg.GetArgString(L"CustomerID")); |
| | | xstring dwname = L"dw_base"; |
| | | xstring colname = L"SupplierID"; |
| | | xstring value = arg.GetArgString(L"CustomerID"); |
| | | KXMLDOMNodeList nlist = GetElement().selectNodes(L"//*[@name='" + dwname + L"']/trans[@for='" + colname + L"']"); |
| | | ViewObject::TransData(nlist, dw_base, 1, colname, value); |
| | | } |
| | | |
| | | if (arg.GetArgString("EntityIDList") != "") |
| | | if (arg.GetArgString(L"EntityIDList") != L"") |
| | | { |
| | | RetrieveItemList(arg.GetArgString("EntityIDList"), arg.GetArgString("Source")); |
| | | RetrieveItemList(arg.GetArgString(L"EntityIDList"), arg.GetArgString(L"Source")); |
| | | } |
| | | |
| | | } |
| | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |