#include <wobject/xstring.hpp>
|
#include <xcontrol/xtreeview.hpp>
|
#include <xcontrol/xdwgrid.hpp>
|
|
#include "vbusiness/vframe/maint.vframe.vbusiness.hpp"
|
#include "viewobject/view.base.hpp"
|
#include "viewobject/view.base.hpp"
|
|
using xml = KXMLDOMDocument;
|
class Quote3MaintWin : public maint
|
{
|
public:
|
xdwgrid dw_goods;
|
xdwtable dw_base;
|
|
xnode m_agentNode; //Agent Condition
|
|
public:
|
Quote3MaintWin(void* implPtr, HWND hWnd) :maint(implPtr, hWnd) {}
|
public:
|
static Quote3MaintWin* CreateInstance(void* implPtr, void* hWnd)
|
{
|
Quote3MaintWin* pWin = new Quote3MaintWin(implPtr, (HWND)hWnd);
|
return pWin;
|
}
|
|
int SetAgent()
|
{
|
xstring xfNodeAgentArea = L"agentarea";
|
xnode anode = GetAgentNode(xfNodeAgentArea);
|
if (m_agentNode)
|
{
|
SetAgentNode(anode, m_agentNode);
|
}
|
else
|
{
|
KXMLDOMElement xframeElement = GetElement();
|
KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*");
|
if (agent)
|
{
|
xstring s = agent.xml();
|
m_agentNode = SetAgentNode(anode, s);
|
}
|
}
|
return 1;
|
}
|
|
//焦点激活处理函数
|
int OnSetFocus(TEvent* evt, int param)
|
{
|
//重置工具条
|
SetAgent();
|
return 1;
|
}
|
|
xstring GetEntityData(LPARAM pr)
|
{
|
dw_base.AcceptText();
|
dw_goods.AcceptText();
|
if (dw_base.GetItemString(1, L"QuoteNo") == L"")
|
{
|
xstring QuoteNo = QuoteView::MakeBillNo();
|
dw_base.SetItemString(1, L"QuoteNo", QuoteNo);
|
}
|
|
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();
|
}
|
|
int SetSeqNo(xdwgrid dw_obj, xstring SeqNoColumn, int nRow)
|
{
|
if (nRow > 1)
|
{
|
int SeqNo = dw_goods.GetItemInt(nRow - 1, SeqNoColumn);
|
if (SeqNo != 0) SeqNo += 10; else SeqNo = nRow * 10;
|
dw_obj.SetItemInt(nRow, SeqNoColumn, SeqNo);
|
}
|
else
|
dw_obj.SetItemInt(nRow, SeqNoColumn, 10);
|
return 1;
|
}
|
|
int DoUpdate(bool showSuccess)
|
{
|
if (publiccode::GetUser().id != dw_base.GetItemString(1, L"SalespersonID"))
|
{
|
alert(L"只允许当前本人修改,保存!");
|
return 0;
|
}
|
|
dw_base.AcceptText();
|
dw_goods.AcceptText();
|
if (dw_base.GetItemString(1, L"QuoteNo") == L"")
|
{
|
xstring QuoteNo = QuoteView::MakeBillNo();
|
dw_base.SetItemString(1, L"QuoteNo", QuoteNo);
|
}
|
|
xstring Source = dw_base.GetItemString(1, L"Source");
|
if (Source != L"客户选单")
|
{
|
if (dw_base.GetItemString(1, L"CustomerID") == L"")
|
{
|
alert(L"请输入客户!");
|
return 0;
|
}
|
if (dw_base.GetItemString(1, L"PriceTerm") == L"")
|
{
|
alert(L"请输入价格条款!");
|
return 0;
|
}
|
if (dw_base.GetItemString(1, L"LoadPort") == L"")
|
{
|
alert(L"请输入出口口岸!");
|
return 0;
|
}
|
}
|
|
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());
|
|
//trace(x.GetXml());
|
//return 1;
|
if (dw_goods.GetRowCount() == 0)
|
{
|
alert(L"请转入产品!");
|
return 0;
|
}
|
if (Source != L"客户选单")
|
{
|
for (int i = 1; i <= dw_goods.GetRowCount(); i++)
|
{
|
if (dw_goods.GetItemString(i, L"FobUnitPrice") == L"" || dw_goods.GetItemString(i, L"FobUnitPrice") == L".000")
|
{
|
alert(L"请输入FOB价格!");
|
return 0;
|
}
|
if (dw_goods.GetItemString(i, L"PaperCardPrice") == L"" || dw_goods.GetItemString(i, L"PaperCardPrice") == L".0000")
|
{
|
alert(L"请输入纸卡价!");
|
return 0;
|
}
|
if (dw_goods.GetItemString(i, L"VATRefundRate") == L"")
|
{
|
alert(L"请输入退税率!");
|
return 0;
|
}
|
if (dw_goods.GetItemString(i, L"ItemMiniQty") == L"")
|
{
|
alert(L"请输入起订量!");
|
return 0;
|
}
|
if (dw_goods.GetItemString(i, L"ItemName") == L"")
|
{
|
alert(L"请输入英文品名!");
|
return 0;
|
}
|
if (dw_goods.GetItemString(i, L"Packages") == L"" || dw_goods.GetItemString(i, L"Packages") == L"0")
|
{
|
alert(L"请输入外箱装数!");
|
return 0;
|
}
|
|
}
|
}
|
xstring error = L"";
|
arg.AddArg(L"content", x.GetXml());
|
trace(x.GetXml());
|
if (url::get(L"/sale/data/Quote/update", arg.GetString(), x) != 1)
|
{
|
error = x.GetXmlDoc().text;
|
alert(error);
|
}
|
else
|
{
|
xstring str = x.GetXmlDoc().documentElement.getAttribute(L"text");
|
if (str == L"true")
|
{
|
dw_goods.ResetUpdateStatus();
|
dw_base.ResetUpdateStatus();
|
if (showSuccess)alert(L"保存成功!");
|
OnRetrieve(dw_base.GetGuid(1));
|
return -1;
|
|
}
|
else
|
{
|
if (showSuccess)alert(L"保存失败!");
|
return -1;
|
}
|
}
|
return 1;
|
}
|
|
int OnSave()
|
{
|
DoUpdate(true);
|
return 1;
|
}
|
|
int ImportProductByText(xstring str)
|
{
|
xstring CustomerID = dw_base.GetItemString(1, L"CustomerID");
|
//alert(str+L"----"+CustomerID);
|
xml x;
|
if (CustomerID == L"")
|
x = QuoteView::LookupProductsByText(str);
|
else
|
x = QuoteView::LookupProductsByText(str, CustomerID);
|
if (!x) return 1;
|
KXMLDOMNodeList items = x.GetXmlDoc().selectNodes(L"/Items/Item");
|
int len = items.length;
|
for (int i = 0; i < len; i++)
|
{
|
KXMLDOMElement e = items.item(i);
|
dw_goods.InsertRow(0);
|
|
//alert(e.xml);
|
int nRow = dw_goods.GetRowCount();
|
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"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"Packages", e.getAttribute(L"QtyPerPkg"));
|
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"));
|
dw_goods.SetItemString(nRow, L"POPrice", e.getAttribute(L"POPrice"));
|
|
dw_goods.SetItemString(nRow, L"SampleFee", e.getAttribute(L"SampleFee"));
|
dw_goods.SetItemString(nRow, L"TestFee", e.getAttribute(L"TestFee"));
|
dw_goods.SetItemString(nRow, L"ModelFee", e.getAttribute(L"ModelFee"));
|
dw_goods.SetItemString(nRow, L"ProductDesc", e.getAttribute(L"ProductDesc"));
|
|
xstring POPrice_display = e.getAttribute(L"POPrice_displaystring");
|
if (POPrice_display != L"") dw_goods.SetItemDisplayString(nRow, L"POPrice", POPrice_display);
|
//xstring POPrice_display = e.getAttribute(L"POPrice_tipstring");
|
//if(POPrice_display !=L"") dw_goods.SetItemDisplayString(nRow,L"POPrice",POPrice_display);
|
|
dw_goods.SetItemString(nRow, L"CurPOPrice", e.getAttribute(L"CurPOPrice"));
|
dw_goods.SetItemString(nRow, L"EnquiryLineID", e.getAttribute(L"EnquiryLineID"));
|
dw_goods.SetItemString(nRow, L"EnquiryPriceListID", e.getAttribute(L"EnquiryPriceListID"));
|
dw_goods.SetItemString(nRow, L"PurcharID", e.getAttribute(L"PurcharID"));
|
|
//alert(e.getAttribute(L"ItemMiniQty"));
|
dw_goods.SetItemString(nRow, L"ItemMiniQty", e.getAttribute(L"ItemMiniQty"));
|
|
if (dw_goods.GetItemString(nRow, L"VolumeDesc") != L"" &&
|
dw_goods.GetItemString(nRow, L"Packages") != L"")
|
{
|
int qty = EvalQtyPerFCL45H(nRow);
|
dw_goods.SetItemString(nRow, L"Packages45H", qty.toString());
|
dw_goods.SetItemDouble(nRow, L"TransportationFee", 5000.0 / qty);
|
}
|
|
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"));
|
}
|
dw_goods.Redraw();
|
|
int row = dw_goods.GetRow();
|
if (row >= 1)
|
{
|
imageview im = GetControl(L"im1");
|
im.ResetEx();
|
xstring skuno = dw_goods.GetItemString(row, L"SKUNo");
|
OnShowImage(skuno, row);
|
im.Redraw();
|
}
|
return 1;
|
}
|
|
double EvalCost(int row)
|
{
|
double cost = 0.0;
|
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, 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, L"VolumeDesc"));
|
double packages = dw_goods.GetItemDouble(row, L"Packages");
|
return (packages * 65.0 / vol).toInt();
|
}
|
double EvalUnitProfit(int row)
|
{
|
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, L"UnitCost");
|
return UnitProfit / UnitCost;
|
}
|
double EvalSaleProfitRate(int row)
|
{
|
double UnitProfit = EvalUnitProfit(row);
|
double FobUnitPrice = dw_goods.GetItemDouble(row, L"FobUnitPrice");
|
return UnitProfit / FobUnitPrice;
|
}
|
|
double EvalExchangeCostRate(int row)
|
{
|
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, L"VolumeDesc"));
|
double packages = dw_goods.GetItemDouble(row, L"Packages");
|
return 80 * vol / packages;
|
}
|
|
double EvalVol(xstring value)
|
{
|
double vol = 1.0;
|
xstring volstr = value;
|
int pos1 = volstr.find(L"*");
|
int pos2 = volstr.find(L"X");
|
int pos3 = volstr.find(L"x");
|
int pos = pos1;
|
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(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(L"pos: " + pos.toString() + L"pos1: " + pos1.toString() + L"pos2: " + pos2.toString() + L"pos3: " + pos3.toString());
|
while (pos >= 0)
|
{
|
xstring tm = volstr.left(pos);
|
volstr = volstr.mid(pos + 1, 9999);
|
vol *= tm.toDouble();
|
|
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 != L"") vol *= volstr.toDouble();
|
return vol / 1000000.0;
|
}
|
|
int ClassifyChanged(int row, xstring ClassifyID)
|
{
|
xml x = ViewObject::RetrieveData(L"/sale/data/Custom3/custom/classifyinfo", L"ClassifyID", ClassifyID);
|
if (x)
|
{
|
KXMLDOMNode o = x.GetXmlDoc().selectSingleNode(L"data/Item");
|
if (o.selectSingleNode(L"VATRefundRate"))
|
{
|
//dw_goods.SetItemString(i,L"VATRefundRate",o.selectSingleNode(L"VATRefundRate").text);
|
dw_goods.ItemChangeTo(row, L"VATRefundRate", o.selectSingleNode(L"VATRefundRate").text);
|
}
|
else
|
{
|
dw_goods.ItemChangeTo(row, L"VATRefundRate", L"");
|
}
|
}
|
return 1;
|
}
|
|
//包装数改变颜色
|
int OnItemAskStyle(ref TNotifyEvent evt, int p)
|
{
|
int DMS_CSSSTYLE = 0x8;
|
ref DWASKSTYLENMHDR hdr = trust(evt.pnmh as ref DWASKSTYLENMHDR);
|
int row = hdr.row;
|
int col = hdr.col;
|
xstring colname = hdr.colname;
|
|
int rows = dw_goods.GetRowCount();
|
if (row < 1 || row > rows)
|
{
|
return 1;
|
}
|
|
if (colname == L"POPrice")
|
{
|
xstring POPrice = dw_goods.GetItemDisplayString(row, L"POPrice");
|
if (POPrice == L"") POPrice = dw_goods.GetItemString(row, L"POPrice");
|
xstring CurPOPrice = dw_goods.GetItemDisplayString(row, L"CurPOPrice");
|
|
xstring POPrices = dw_goods.GetItemString(row, L"POPrices");
|
|
if (POPrice == L"" || CurPOPrice == L"" || POPrices == L"") return 1;
|
if (CurPOPrice.find(POPrice, 0) < 0)
|
//if(POPrice.find(POPrices,0)<0)
|
{
|
hdr.mask = DMS_CSSSTYLE;
|
hdr.cssstyle = L"color:#ff0000;text-decoration:underline";
|
}
|
}
|
return 1;
|
}
|
|
int OnItemChanged(ref TNotifyEvent evt, int p)
|
{
|
ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR);
|
xstring colname = hdr.colname;
|
xstring value = hdr.data;
|
int row = hdr.row;
|
|
double VATRefund = 0.0;
|
double VATRefundRate = 0.0;
|
if (colname == L"ClassifyID")
|
{
|
return ClassifyChanged(row, value);
|
}
|
if ((colname == L"GoodsNo" || colname == L"CustomerItemNo") && value != L"")
|
{
|
if (colname == L"CustomerItemNo")
|
{
|
if (dw_goods.GetItemString(row, L"GoodsNo") != L"") return 1;
|
}
|
xml x;
|
xstring CustomerID = dw_base.GetItemString(1, L"CustomerID");
|
xstring sval = value;
|
if (colname == L"GoodsNo") sval = L"gs:" + value;
|
if (colname == L"CustomerItemNo") sval = L"cs:" + value;
|
if (CustomerID != L"")
|
x = QuoteView::LookupProductsByText(sval, CustomerID);
|
else
|
x = QuoteView::LookupProductsByText(sval);
|
if (!x) return 1;
|
KXMLDOMNodeList items = x.GetXmlDoc().selectNodes(L"/Items/Item");
|
int len = items.length;
|
if (len == 0)
|
{
|
if (colname == L"GoodsNo")alert(L"没有此公司型号!");
|
return 1;
|
}
|
if (len >= 1)
|
{
|
KXMLDOMElement e = items.item(0);
|
int nRow = dw_goods.GetRow();
|
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"));
|
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"VolumeDesc", e.getAttribute(L"VolumeDesc"));
|
dw_goods.SetItemString(nRow, L"Packages", e.getAttribute(L"QTYPerPkg"));
|
|
if (dw_goods.GetItemString(nRow, L"VolumeDesc") != L"" &&
|
dw_goods.GetItemString(nRow, L"Packages") != L"")
|
{
|
int qty1 = EvalQtyPerFCL45H(nRow);
|
dw_goods.SetItemString(nRow, L"Packages45H", qty1.toString());
|
dw_goods.SetItemDouble(nRow, L"TransportationFee", 5000.0 / qty1);
|
}
|
dw_goods.Redraw();
|
}
|
}
|
|
else if (colname == L"POPrice" || colname == L"PaperCardPrice" || colname == L"TransportationFee" ||
|
colname == L"OtherFee" || colname == L"ManagementFee")
|
{
|
dw_goods.SetItemDouble(row, L"UnitCost", EvalCost(row));
|
|
if ((colname == L"POPrice" || colname == L"PaperCardPrice") && dw_goods.GetItemString(row, L"VATRefundRate") != L"")
|
{
|
dw_goods.SetItemDouble(row, L"VATRefund", EvalRefund(row));
|
}
|
}
|
else if (colname == L"VATRefundRate" && value != L"")
|
{
|
dw_goods.SetItemDouble(row, L"VATRefund", EvalRefund(row));
|
}
|
else if (colname == L"VolumeDesc" || colname == L"Packages")
|
{
|
if (dw_goods.GetItemString(row, L"VolumeDesc") != L"" &&
|
dw_goods.GetItemString(row, L"Packages") != L"")
|
{
|
int qty = EvalQtyPerFCL45H(row);
|
dw_goods.SetItemString(row, L"Packages45H", qty.toString());
|
dw_goods.SetItemDouble(row, L"TransportationFee", EvalTransportationFee(row));
|
dw_goods.SetItemDouble(row, L"UnitCost", EvalCost(row));
|
}
|
}
|
else if (colname == L"FobUnitPrice")
|
{
|
xstring CurrencyCode = dw_base.GetItemString(1, L"CurrencyCode");
|
xstring expRate = L"";
|
xstring exchRate = L"";
|
xstring prepareFeeRate = L"";
|
|
xml x0 = ViewObject::RetrieveData(L"/sale/data/GDN3/profit/param", L"item", L"mgtFeeRate");
|
if (x0.GetXmlDoc().selectSingleNode(L"root/item/@value"))
|
expRate = x0.GetXmlDoc().selectSingleNode(L"root/item/@value").text;
|
x0 = ViewObject::RetrieveData(L"/sale/data/GDN3/profit/param", L"item", L"cryrate");
|
if (x0.GetXmlDoc().selectSingleNode(L"root/item/@value"))
|
exchRate = x0.GetXmlDoc().selectSingleNode(L"root/item/@value").text;
|
x0 = ViewObject::RetrieveData(L"/sale/data/GDN3/profit/param", L"item", L"prepareFeeRate");
|
if (x0.GetXmlDoc().selectSingleNode(L"root/item/@value"))
|
prepareFeeRate = x0.GetXmlDoc().selectSingleNode(L"root/item/@value").text;
|
//alert(exchRate);
|
//alert(expRate);
|
double r1 = exchRate.toDouble();
|
double r2 = expRate.toDouble();
|
double r3 = prepareFeeRate.toDouble();
|
double val = value.toDouble();
|
if (CurrencyCode == L"RMB" || CurrencyCode == L"CNY")
|
{
|
if (exchRate != L"")
|
{
|
double ManagementFee = (val / r1) * r1;
|
double OtherFee = (val / r1) * r3;
|
dw_goods.SetItemDouble(row, L"ManagementFee", ManagementFee);
|
dw_goods.SetItemDouble(row, L"OtherFee", OtherFee);
|
}
|
}
|
else
|
{
|
dw_goods.SetItemDouble(row, L"ManagementFee", val * r2);
|
dw_goods.SetItemDouble(row, L"OtherFee", val * r3);
|
}
|
dw_goods.SetItemDouble(row, L"UnitCost", EvalCost(row));
|
}
|
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, 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.Redraw();
|
|
return 1;
|
}
|
|
int OnBaseItemChanged(ref TNotifyEvent evt, int p)
|
{
|
ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR);
|
xstring colname = hdr.colname;
|
xstring value = hdr.data;
|
|
xstring dwname = L"dw_base";
|
if (value != L"")
|
{
|
KXMLDOMNodeList nlist = GetElement().selectNodes(L"//*[@name='" + dwname + L"']/trans[@for='" + colname + L"']");
|
ViewObject::TransData(nlist, dw_base, hdr.row, colname, value);
|
}
|
if (colname == L"ExchangeRate")
|
{
|
if (dw_goods.GetRowCount() > 0)
|
{
|
for (int i = 1; i <= dw_goods.GetRowCount(); 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.RedrawEx();
|
}
|
|
return 1;
|
}
|
|
int OnPriceEval()
|
{
|
OpenWindow(L"dev:xpage[eval.quote3.vx]", cast(dw_goods as int));
|
return 1;
|
}
|
|
|
int OnRowChanged(ref TNotifyEvent evt, int p)
|
{
|
ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR);
|
int row = hdr.row;
|
|
imageview im = GetControl(L"im1");
|
im.ResetEx();
|
xstring skuno = dw_goods.GetItemString(row, L"SKUNo");
|
OnShowImage(skuno, row);
|
im.Redraw();
|
|
return 1;
|
}
|
|
int OnShowImage()
|
{
|
int rowCount = dw_goods.GetRowCount();
|
xstring skunos;
|
for (int i = 1; i <= rowCount; i++)
|
{
|
xstring skuno = dw_goods.GetItemString(i, L"SKUNo");
|
if (i == 1)
|
skunos = skuno;
|
else
|
skunos += L",L" + skuno;
|
}
|
|
xaserverarg arg_pic = new xaserverarg;
|
arg_pic.setNativePointer(arg_pic.CreateInstance());
|
arg_pic.AddArg(L"SKUNoList", skunos);
|
arg_pic.AddArg(L"ParentWindow", GetHWND().toString());
|
arg_pic.AddArg(L"OpenFlag", L"1");
|
OpenWindow(L"dev:xpage[SKU.PictureView.Product3.vx]", cast(arg_pic as int));
|
|
return 1;
|
}
|
|
int OnShowImage(xstring skuno, int row)
|
{
|
imageview im = GetControl(L"im1");
|
|
xml xp = new xml;
|
xp.setNativePointer(xml::CreateInstance());
|
xaserverarg arg_pic = new xaserverarg;
|
arg_pic.setNativePointer(arg_pic.CreateInstance());
|
arg_pic.AddArg(L"SKUNo", skuno);
|
|
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");
|
if (customerItemNo != L"")
|
{
|
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)
|
{
|
trace(xp.GetXml());
|
return 1;
|
}
|
else
|
{
|
KXMLDOMNodeList nlistp = xp.GetXmlDoc().selectNodes(L"ImageList/image");
|
int lenp = nlistp.length;
|
for (int ip = 0; ip < lenp; ip++)
|
{
|
hasIamge = true;
|
KXMLDOMElement xitem = nlistp.item(ip);
|
xstring picname = xitem.selectSingleNode(L"PicPath").text;
|
xstring 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 = L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
|
if (url::get(res, arg_pic.GetString(), xp) != 1)
|
{
|
trace(xp.GetXml());
|
return 1;
|
}
|
else
|
{
|
nlistp = xp.GetXmlDoc().selectNodes(L"ImageList/image");
|
lenp = nlistp.length;
|
for (ip = 0; ip < lenp; ip++)
|
{
|
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);
|
}
|
}
|
}
|
return 1;
|
}
|
|
|
int OnPrint()
|
{
|
if (dw_base.GetItemString(1, L"QuoteNo") == L"")
|
{
|
alert(L"请先保存数据!");
|
return 1;
|
}
|
xaserverarg arg = new xaserverarg;
|
arg.setNativePointer(arg.CreateInstance());
|
arg.AddArg(L"EntityName", L"Quote", L"");
|
arg.AddArg(L"EntityID", dw_base.GetItemString(1, L"QuoteID"), L"");
|
arg.AddArg(L"EntityNo", dw_base.GetItemString(1, L"QuoteNo"), L"");
|
trace(dw_base.GetItemString(1, L"QuoteID") + L"***" + dw_base.GetItemString(1, L"QuoteNo"));
|
int p = arg.ptr_native_;
|
openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", p);
|
return 1;
|
}
|
|
int ReSeqNo(xstring SeqNoColumn)
|
{
|
for (int i = 1; i <= dw_goods.GetRowCount(); i++)
|
{
|
dw_goods.SetItemString(i, SeqNoColumn, (i * 10).toString());
|
}
|
dw_goods.Redraw();
|
return 1;
|
}
|
|
//命令发布函数
|
int OnCmdDispatch(xstring comdid)
|
{
|
if (comdid == L"xmNewProduct")
|
{
|
//xaserverarg arg = new xaserverarg;
|
//arg.setNativePointer(arg.CreateInstance());
|
openUrl(L"/sale/view/Quote3/xpage/quick/newestproduct", GetHWND());
|
return 1;
|
}
|
else if (comdid == L"xmPrint") return OnPrint();
|
else if (comdid == L"xmImage")
|
return OnShowImage();
|
else if (comdid == L"xmImportProduct")
|
{
|
xstring str = GetControl(L"goods").GetText();
|
str = str.trim();
|
if (str == L"")
|
{
|
xaserverarg arg1 = new xaserverarg;
|
arg1.setNativePointer(arg1.CreateInstance());
|
arg1.AddArg(L"HWND", GetHWND().toString());
|
arg1.AddArg(L"CustomerID", dw_base.GetItemString(1, L"CustomerID"));
|
OpenWindow(L"dev:xpage[Product.Select.vx]", cast(arg1 as int));
|
int row = dw_goods.GetRow();
|
if (row >= 1)
|
{
|
imageview im = GetControl(L"im1");
|
im.ResetEx();
|
xstring skuno = dw_goods.GetItemString(row, L"SKUNo");
|
OnShowImage(skuno, row);
|
im.Redraw();
|
}
|
}
|
else
|
ImportProductByText(str);
|
return 1;
|
}
|
else if (comdid == L"xmSave")
|
{
|
if (publiccode::GetUser().id != dw_base.GetItemString(1, L"SalespersonID"))
|
{
|
alert(L"只允许当前本人修改,保存!");
|
return 0;
|
}
|
OnSave();
|
return 1;
|
}
|
else if (comdid == L"xmPriceEval")
|
return OnPriceEval();
|
else if (comdid == L"xmOpen")
|
{
|
xaserverarg arg = new xaserverarg;
|
arg.setNativePointer(arg.CreateInstance());
|
OpenWindow(L"dev:xpage[SOQuote.list.vx]", cast(arg as int));
|
if (arg.GetArgString(L"id") != L"") return OnRetrieve(arg.GetArgString(L"id"));
|
return 1;
|
}
|
else if (comdid == L"xmDeleteRow")
|
{
|
dw_goods.DeleteRow(0);
|
return 1;
|
}
|
else if (comdid == L"xmAskGoodsNo")
|
{
|
return OnAskGoodsNo();
|
}
|
else if (comdid == L"xmReSeqNo")
|
{
|
if (win32::MessageBox(GetHWND(), L"是否重置序号!", L"提示1", 1) == 2)
|
return 1;
|
return ReSeqNo(L"SeqNo");
|
}
|
else if (comdid == L"xmProductDesc")
|
{
|
xaserverarg arg2 = new xaserverarg;
|
arg2.setNativePointer(arg2.CreateInstance());
|
int row2 = dw_goods.GetRow();
|
if (row2 < 1) return 0;
|
xstring str2 = dw_goods.GetItemString(row2, L"ProductDesc");
|
arg2.AddArg(L"value", str2);
|
OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg2.getNativePointer());
|
return 1;
|
}
|
else if (comdid == L"xmDescription")
|
{
|
arg2 = new xaserverarg;
|
arg2.setNativePointer(arg2.CreateInstance());
|
row2 = dw_goods.GetRow();
|
if (row2 < 1) return 0;
|
str2 = dw_goods.GetItemString(row2, L"Description");
|
arg2.AddArg(L"value", str2);
|
OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg2.getNativePointer());
|
if (arg2.GetArgString(L"comdid") == L"xmOK")
|
{
|
str2 = arg2.GetArgString(L"value");
|
dw_goods.AcceptText();
|
dw_goods.SetItemString(row2, L"Description", str2);
|
dw_goods.Redraw();
|
}
|
return 1;
|
}
|
else if (comdid == L"xmAddRow")
|
{
|
int nRow = dw_goods.InsertRow(0);
|
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");
|
|
return 1;
|
}
|
else if (comdid == L"xmClose")
|
{
|
CloseWindow();
|
return 1;
|
}
|
else if (comdid.find(L"ImportXml:", 0) == 0)
|
{
|
xstring strImport = comdid.mid(L"ImportXml:".length(), 9999);
|
ImportProductByText(strImport);
|
return 1;
|
}
|
return 0;
|
}
|
|
int OnImgDBClicked(ref TNotifyEvent evt, int pr)
|
{
|
ref IMGNNMHDR nmtv = evt.pnmh;
|
xstring src = nmtv.path;
|
/*if(src.length() > 60)
|
src = src.right(44);
|
else
|
src=src.mid(src.find(L"Thumbs", 0)+6, 50);
|
*/
|
xaserverarg arg = new xaserverarg;
|
arg.setNativePointer(arg.CreateInstance());
|
//arg.AddArg(L"src",L"/business/products/chanpin"+src);
|
arg.AddArg(L"src", src);
|
|
//win::OpenWindow(L"dev:xpage[BigPicture.vx]",arg);
|
|
int h = openUrl(L"/sale/view/ProductLibrary/xpage/bigpictureview", arg);
|
return 1;
|
/*
|
xwin x = new xwin;
|
x.setNativePointer(h);
|
m_winHwnd = x.GetHWND();
|
|
xstring sh = doc.GetXml();
|
int p = cast(sh as int);
|
win32::SendMessage(m_winHwnd, 0x401, p, 0);
|
*/
|
return 1;
|
}
|
|
//命令处理事件
|
int OnXCommand(ref TXCommandEvent evt, int param)
|
{
|
return OnCmdDispatch(evt.pStrID);
|
}
|
|
int OnDoubleClicked(ref TNotifyEvent evt, int p)
|
{
|
|
ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR);
|
xstring colname = hdr.colname;
|
int row = hdr.row;
|
|
dw_goods.AcceptText();
|
|
|
int hCursor = xutil::SetCursorWait();
|
if (colname == L"CurPOPrice")
|
{
|
xstring str = dw_goods.GetItemDisplayString(row, L"CurPOPrice");
|
//xstring str =dw_goods.GetItemString(row,L"POPrices");
|
|
if (str.find(L"[", 0) > 0)
|
{
|
xstring val = str.left(str.find(L"[", 0));
|
|
xstring val1 = val;
|
if (val.right(1) == L"A" or val.right(1) == L"B" or val.right(1) == L"C")
|
val1 = val.left(val.length() - 1);
|
|
dw_goods.ItemChangeTo(dw_goods.GetRow(), L"POPrice", val1);
|
dw_goods.SetItemDisplayString(dw_goods.GetRow(), L"POPrice", val);
|
}
|
//alert(dw_goods.GetItemString(dw_goods.GetRow(),L"CurPOPrice"));
|
dw_goods.SetItemString(dw_goods.GetRow(), L"EnquiryPriceListID",
|
dw_goods.GetItemString(dw_goods.GetRow(), L"CurPOPrice"));
|
//dw_goods.SetItemString(dw_goods.GetRow(),L"EnquiryLineID",
|
// dw_goods.GetItemString(dw_goods.GetRow(),L"CurPOPrice"));
|
}
|
dw_goods.Redraw();
|
xutil::RestoreCursor(hCursor);
|
return 1;
|
}
|
|
int OnAttachEvent()
|
{
|
//绑定工具条点击事件
|
AttachEvent(L"WM_XCOMMAND", OnXCommand);
|
//获取焦点事件,用于重置工具条
|
AttachEvent(L"WM_SETFOCUS", OnSetFocus);
|
AttachEvent(L"dw_goods", L"DWV_ITEMCHANGED", OnItemChanged);
|
AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", OnBaseItemChanged);
|
AttachEvent(L"im1", L"IMG_LDBCLICK", OnImgDBClicked);
|
AttachEvent(L"dw_goods", L"DWV_ROWFOCUSCHANGED", OnRowChanged);
|
AttachEvent(L"dw_goods", L"DWV_ASKSTYLE", OnItemAskStyle);
|
AttachEvent(L"dw_goods", L"DWV_DOUBLECLICKED", OnDoubleClicked);//行双击
|
AttachEvent(L"dw_goods", L"DWV_ITEMCHANGING", OnItemChanging);
|
|
AttachCloseWindow();
|
|
return 1;
|
}
|
|
int OnItemChanging(ref TNotifyEvent evt, int p)
|
{
|
ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR);
|
xstring colname = hdr.colname;
|
xstring value = hdr.data;
|
int row = hdr.row;
|
|
if (value == L"") return 1;
|
xstring cellType = dw_goods.GetColumnProp(colname, L"celltype");
|
if (cellType == L"xs:decimal" || cellType == L"xs:integer")
|
{
|
if (value.isNumber() == false)
|
{
|
alert(value + L"不是数字!");
|
hdr.idFrom = -1;
|
return 1;
|
}
|
}
|
}
|
|
int OnRetrieve(xstring id)
|
{
|
xml x = new xml;
|
x.setNativePointer(xml::CreateInstance());
|
xaserverarg arg = new xaserverarg;
|
arg.setNativePointer(arg.CreateInstance());
|
arg.AddArg(L"id", id);
|
//alert(id);
|
if (getUrl(L"/sale/data/Quote/maint", arg.GetString(), x) != 1)
|
{
|
trace(x.GetXmlDoc().text);
|
return -1;
|
}
|
else
|
{
|
trace(x.GetXml());
|
dw_base.Retrieve(x);
|
dw_base.Redraw();
|
dw_goods.Retrieve(x);
|
dw_goods.Redraw();
|
|
if (dw_goods.GetRowCount() > 0)
|
{
|
imageview im = GetControl(L"im1");
|
im.ResetEx();
|
xstring skuno = dw_goods.GetItemString(1, L"SKUNo");
|
OnShowImage(skuno, 1);
|
im.Redraw();
|
}
|
}
|
return 1;
|
}
|
|
xstring GetExchangeRate(xstring pcur, xstring pdate)
|
{
|
|
if (pcur.upper() == L"RMB") return "1";
|
xstring exchangeRate = L"";
|
if (exchangeRate == L"") {
|
xml x = ViewObject::RetrieveData(L"/sale/data/GDN3/profit/param", L"item", L"cryrate");
|
if (x.GetXmlDoc().selectSingleNode(L"root/item/@value"))
|
exchangeRate = x.GetXmlDoc().selectSingleNode(L"root/item/@value").text;
|
}
|
/*xml x = new xml;
|
x.setNativePointer(xml::CreateInstance());
|
xaserverarg args=new xaserverarg;
|
args.setNativePointer(args.CreateInstance());
|
args.AddArg(L"currency", pcur);
|
if(pdate != L"") args.AddArg(L"date", pcur);
|
xstring ls_date=L"";
|
if(xaserver::ExecXQuery(L"",L"[GetCurrencyExchangeRate.xq]",args.GetString(),x)==1)
|
{
|
KXMLDOMElement e= x.GetXmlDoc().documentElement;
|
if(e)
|
if(e.selectSingleNode(L"ExchangeRate"))
|
ls_date = e.selectSingleNode(L"ExchangeRate").text; //e.getAttribute(L"date");
|
}
|
return ls_date+L"";
|
*/
|
return exchangeRate;
|
|
}
|
|
xstring GetExchangeRate(xstring pcur)
|
{
|
return GetExchangeRate(pcur, L"");
|
}
|
|
int OnInit()
|
{
|
//公司抬头、报价人、报价日期
|
xstring sdate = publiccode::GetCurrentDate();
|
dw_base.SetItemString(1, L"QuoteDate", 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"CurrencyCode", L"USD");
|
dw_base.SetItemDisplayString(1, L"CurrencyCode", L"USD");
|
|
xstring exchangeRate = L"";
|
xml x = ViewObject::RetrieveData(L"/sale/data/GDN3/profit/paramEx", L"ETD", sdate);
|
if (x.GetXmlDoc().selectSingleNode(L"root/item/@value"))
|
exchangeRate = x.GetXmlDoc().selectSingleNode(L"root/item/@value").text;
|
if (exchangeRate != L"")
|
{
|
dw_base.SetItemString(1, L"ExchangeRate", exchangeRate);
|
}
|
else
|
{
|
dw_base.SetItemString(1, L"ExchangeRate", L"6.49");
|
}
|
//dw_base.SetItemString(1,L"ExchangeRate",GetExchangeRate(L"USD"));
|
|
dw_base.SetItemString(1, L"CompanyID", L"E9E3C542-062C-4957-B8F4-9B92C3E351FC");
|
dw_base.SetItemDisplayString(1, L"CompanyID", L"宁波家尔佳进出口有限公司");
|
|
/*xstring ss = L"select (select EnglishName from Party where PartyID = CompanyID) as 'CompanyID/@_displaystring',CompanyID from HR_Org where OrgID = '{$id}' for xml PATH('root'),ELEMENTS XSINIL";
|
xstring scguid;
|
xstring sCename;
|
xml x1 = RetrieveSqlData(ss,L"id",sg);
|
KXMLDOMElement e1 = x1.GetXmlDoc().documentElement;
|
scguid = sureNodeText(e1,L"CompanyID");
|
sCename = sureNodeText(e1,L"CompanyID/@_displaystring");
|
*/
|
|
return 1;
|
}
|
|
int QuoteList(xstring QuoteID)
|
{
|
xml x = new xml;
|
x.setNativePointer(xml::CreateInstance());
|
xaserverarg arg = new xaserverarg;
|
arg.setNativePointer(arg.CreateInstance());
|
arg.AddArg(L"id", QuoteID);
|
|
if (getUrl(L"/sale/data/Quote/maintOne", arg.GetString(), x) != 1)
|
{
|
trace(x.GetXmlDoc().text);
|
return -1;
|
}
|
else
|
{
|
dw_base.Retrieve(x);
|
dw_base.Redraw();
|
dw_goods.Retrieve(x);
|
dw_goods.Redraw();
|
|
if (dw_goods.GetRowCount() > 0)
|
{
|
imageview im = GetControl(L"im1");
|
im.ResetEx();
|
xstring skuno = dw_goods.GetItemString(1, L"SKUNo");
|
OnShowImage(skuno, 1);
|
im.Redraw();
|
}
|
}
|
dw_base.SetItemString(1, L"QuoteNo", L"");
|
return 1;
|
}
|
|
int onload()
|
{
|
dw_goods = GetControl(L"dw_goods");
|
//dw_goods .openUrl(L"/sale/view/Quote3/template/goods");
|
dw_goods.openUrl(L"/sale/view/Quote3/template/item/pricelist");
|
dw_goods.SetColumnState(L"ItemID", false);
|
dw_goods.SetColumnState(L"EnquiryLineID", false);
|
dw_goods.SetColumnState(L"EnquiryPriceListID", false);
|
dw_goods.SetColumnState(L"POPrices", false);
|
dw_goods.SetColumnState(L"ClassifyID", false);
|
dw_goods.SetColumnState(L"Description", false);
|
|
|
dw_goods.SetAskStyle(true);
|
|
dw_base = GetControl(L"dw_base");
|
dw_base.openUrl(L"/sale/view/Quote3/template/base");
|
//dw_base.SetSelectionBorder(0);
|
dw_base.SetColHeaderHeight(0);
|
dw_base.SetRowSelectorWidth(0);
|
dw_base.SetHScrollState(false);
|
dw_base.SetVScrollState(false);
|
|
if (GetParam())
|
{
|
xaserverarg arg = new xaserverarg;
|
arg.setNativePointer(GetParam());
|
|
xstring QName = arg.GetArgString(L"QuoteName");
|
if (QName != L"")
|
{
|
if (arg.GetArgString(L"QuoteID") != L"")
|
{
|
QuoteList(arg.GetArgString(L"QuoteID"));
|
}
|
}
|
//alert(arg.GetString());
|
xstring QuoteNo = arg.GetArgString(L"QuoteNo");
|
if (QuoteNo == L"") QuoteNo = arg.GetArgString(L"EntityNo");
|
if (QuoteNo != L"")
|
{
|
OnRetrieve(QuoteNo);
|
}
|
else
|
{
|
OnInit();
|
if (arg.GetArgString(L"CustomerID") != L"")
|
{
|
dw_base.SetItemDisplayString(1, L"CustomerID", arg.GetArgString(L"CustomerName"));
|
dw_base.ItemChangeTo(1, L"CustomerID", arg.GetArgString(L"CustomerID"));
|
xstring dwname = L"dw_base";
|
xstring colname = L"CustomerID";
|
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);
|
}
|
}
|
}
|
else
|
OnInit();
|
|
OnAttachEvent();
|
|
//dw_base.SetEditUpperMode(true);
|
//dw_goods.SetEditUpperMode(true);
|
|
return 1;
|
}
|
|
int OnAskGoodsNo()
|
{
|
int rowCount = dw_goods.GetRowCount();
|
xstring skunos = L"";
|
for (int i = 1; i <= rowCount; i++)
|
{
|
if (dw_goods.GetItemString(i, L"SKUNo") != L"" && dw_goods.GetItemString(i, L"GoodsNo") == L"")
|
{
|
if (skunos == L"")
|
skunos = dw_goods.GetItemString(i, L"SKUNo");
|
else
|
skunos += L",L" + dw_goods.GetItemString(i, L"SKUNo");
|
}
|
}
|
xaserverarg arg = ViewObject::MakeArg();
|
arg.AddArg(L"SKUNoList", skunos);
|
OpenWindow(L"dev:xpage[Product.FetchNo.vx]", cast(arg as int));
|
return 1;
|
}
|
|
int onloaded()
|
{
|
SetAgent();
|
|
return 1;
|
}
|
};
|