#include <wobject/xstring.hpp>
|
#include <xcontrol/xtreeview.hpp>
|
#include <xcontrol/xdwgrid.hpp>
|
#include <xcontrol/ximageview.hpp>
|
#include <xcontrol/xcell.hpp>
|
#include <adt/xarray.hpp>
|
#include <win32/xfile.hpp>
|
#include <wobject/xdouble.hpp>
|
|
|
#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
|
#include "viewobject/view.base.hpp"
|
#include "viewobject/quote.view.hpp"
|
|
using xml = KXMLDOMDocument;
|
class __declspec(dllexport) QuoteFileView : public xframe
|
{
|
|
public:
|
QuoteFileView(void* implPtr, HWND hWnd):xframe(implPtr, hWnd) {}
|
public:
|
static QuoteFileView* CreateInstance(void* implPtr, void* hWnd)
|
{
|
QuoteFileView* pWin = new QuoteFileView(implPtr, (HWND)hWnd);
|
return pWin;
|
}
|
public:
|
xcell dw_cell;
|
xnode m_agentNode; //Agent Condition
|
xstring filename;
|
xstring fileid;
|
xstring templateurl;
|
xstring taskid;
|
xml purcher;
|
|
xdwgrid dw_goods;
|
xdwtable dw_base;
|
xstring tabsheet;
|
|
xstring templateID;
|
xstring entityID;
|
xstring entityItemID;
|
xstring action;
|
xstring processurl;
|
|
int ARow;
|
int ACol;
|
xstring orivalue;
|
bool bPurchPrice;
|
|
int SetAgent()
|
{
|
xstring xfNodeAgentArea = L"agentarea";
|
xnode anode = GetAgentNode(xfNodeAgentArea);
|
if (m_agentNode)
|
{
|
SetAgentNode(anode, m_agentNode);
|
}
|
else
|
{
|
xstring path = L"agent/" + xfNodeAgentArea + L"[1]/*";
|
if (action == L"purch") path = L"agent/" + xfNodeAgentArea + L"[2]/*";
|
KXMLDOMElement xframeElement = GetElement();
|
KXMLDOMElement agent = xframeElement.selectSingleNode(path);
|
if (agent)
|
{
|
xstring s = agent.xml();
|
m_agentNode = SetAgentNode(anode, s);
|
}
|
}
|
return 1;
|
}
|
|
xstring GetImageUrl(xstring id)
|
{
|
xml xp ;
|
xaserverarg arg_pic;
|
arg_pic.AddArg(L"id", id);
|
|
xstring res = L"/sale/data/productlibrary3/image/url";
|
if (xurl::get(res, arg_pic.GetString(), xp) != 1)
|
{
|
trace(xp.xml());
|
return 1;
|
}
|
else
|
{
|
xstring path = xp.text();
|
if (path != L"") return path;
|
}
|
|
return L"/business/products/chanpin/" + id.left(2) + L"/" + id + L".jpg";
|
}
|
|
xstring GetGuid()
|
{
|
return publiccode::GetGuid();
|
}
|
|
int getItemHeadRow(xcell dw_obj)
|
{
|
int rowHeader = -1;
|
int rowCount = dw_obj.GetValidRow();
|
for (int row = 1; row <= rowCount; row++)
|
{
|
if (dw_obj.GetItemString(row, 0) == L"±êÌâ") return row;
|
if (dw_obj.GetItemString(row, 1) == L"SKUID" || dw_obj.GetItemString(row, 2) == L"SKUID") return row;
|
}
|
return -1;
|
}
|
|
double calcVol(xstring volDesc)
|
{
|
xstring sl = L"";
|
xstring sw = L"";
|
xstring sh = L"";
|
|
xstring val = volDesc;
|
val = val.replace(L"x", L"X");
|
val = val.replace(L"*", L"X");
|
|
//parse length
|
int pos = val.find(L"X");
|
if (pos >= 0)
|
sl = val.left(pos);
|
else
|
sl = val;
|
|
//parse width
|
if (pos >= 0)
|
{
|
val = val.mid(pos + 1, 9999);
|
pos = val.find(L"X");
|
if (pos >= 0)
|
sw = val.left(pos);
|
else
|
sw = val;
|
}
|
|
//parse height
|
if (pos >= 0)
|
{
|
val = val.mid(pos + 1, 9999);
|
pos = val.find(L"X");
|
if (pos >= 0)
|
sh = val.left(pos);
|
else
|
sh = val;
|
}
|
|
double ret = 0.0;
|
if (sw == L"") ret = sl.toDouble();
|
else if (sh == L"") ret = sl.toDouble() * sw.toDouble();
|
else ret = sl.toDouble() * sw.toDouble() * sh.toDouble();
|
return ret;
|
}
|
|
int ShowImageOne(ximageview im, xstring str, xstring tm)
|
{
|
int spos = str.find(tm + L":");
|
if (spos >= 0)
|
{
|
int pos = (str + L";").find(L";", spos + 1);
|
int pos0 = spos + tm.length() + 1;
|
xstring guids = str.mid(pos0, pos - pos0);
|
while (true)
|
{
|
xstring guid = guids;
|
if (guids.find(L",") >= 0)
|
{
|
guid = guids.left(guids.find(L","));
|
guids = guids.mid(guids.find(L",") + 1, 99999);
|
}
|
else
|
{
|
guid = guids;
|
guids = L"";
|
}
|
if (guid != L"")
|
{
|
xstring picname = GetImageUrl(guid);
|
im.AddImages(picname, L"");
|
return 1;
|
}
|
if (guids == L"") break;
|
}
|
}
|
return 1;
|
}
|
|
int ShowImage(xstring str, xstring tm)
|
{
|
ximageview im = GetControl(L"frame:im1");
|
|
int spos = str.find(tm + L":");
|
if (spos >= 0)
|
{
|
int pos = (str + L";").find(L";", spos + 1);
|
int pos0 = spos + tm.length() + 1;
|
xstring guids = str.mid(pos0, pos - pos0);
|
while (true)
|
{
|
xstring guid = guids;
|
if (guids.find(L",") >= 0)
|
{
|
guid = guids.left(guids.find(L","));
|
guids = guids.mid(guids.find(L",") + 1, 99999);
|
}
|
else
|
{
|
guid = guids;
|
guids = L"";
|
}
|
if (guid != L"")
|
{
|
xstring goodno = L"¿Í»§Í¼Æ¬";
|
if (tm == L"supplier-photo") goodno = L"¹©Ó¦ÉÌͼƬ";
|
xstring picname = GetImageUrl(guid);//"/business/products/chanpin/"+guid.left(2)+L"/"+guid+L".jpg";
|
im.AddImages(picname, goodno);
|
}
|
if (guids == L"") break;
|
}
|
}
|
return 1;
|
}
|
|
xstring getImageList(xstring idlist)
|
{
|
xstring strs = idlist.trim();
|
xstring str = L"";
|
xstring fstr = L"";
|
while (strs != L"")
|
{
|
int pos = strs.find(L",");
|
if (pos < 0)
|
{
|
str = strs;
|
strs = L"";
|
}
|
else
|
{
|
str = strs.left(pos);
|
strs = strs.mid(pos + 1, 9999);
|
}
|
if (fstr == L"")
|
fstr = GetImageUrl(str);
|
else
|
fstr += L"," + GetImageUrl(str);
|
}
|
return fstr;
|
}
|
|
xstring GetSaleFullData(xcell cell)
|
{
|
xstring content = L"";
|
xstring base = L"";
|
base += L"<QuoteNo>" + getBaseItem(cell, L"±¨¼Ûµ¥ºÅ:") + L"</QuoteNo>";
|
base += L"<ExpDate>" + getBaseItem(cell, L"±¨¼Û½ØÖ¹ÈÕÆÚ£º") + L"</ExpDate>";
|
base += L"<PrjName>" + getBaseItem(cell, L"ÏîÄ¿Ãû³Æ:") + L"</PrjName>";
|
base += L"<QuoteDate>" + dw_base.GetItemString(1, L"QuoteDate") + L"</QuoteDate>";
|
|
int startRow = getItemHeadRow(cell);
|
|
//ûÓÐÕÒµ½ÉÌÆ·ÐеıêÌâ
|
if (startRow < 1) return L"";
|
startRow++;
|
|
int colItemNo = getItemCol(cell, startRow - 1, L"ÎÒ˾ÐͺÅ,ItemNo");
|
int colCustomerItemNo = getItemCol(cell, startRow - 1, L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(cell, startRow - 1, L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(cell, startRow - 1, L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(cell, startRow - 1, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colBuyerPrice = getItemCol(cell, startRow - 1, L"²É¹º¼Û,²É¹º¼Û¸ñ");
|
int colCustomerImage = getItemCol(cell, startRow - 1, L"Photo,ͼƬ");
|
int colSKUID = getItemCol(cell, startRow - 1, L"SKUID");
|
int colSaleRemark = getItemCol(cell, startRow - 1, L"ÒµÎñTo²É¹º±¸×¢");
|
|
int colBuyerMOQ = getItemCol(cell, startRow - 1, L"MOQ");
|
int colBuyerRemark = getItemCol(cell, startRow - 1, L"²É¹ºToÒµÎñ±¸×¢");
|
int colFactoryImage = getItemCol(cell, startRow - 1, L"¹¤³§Í¼Æ¬");
|
int colGWT = getItemCol(cell, startRow - 1, L"Ã«ÖØ,Ã«ÖØ(KG)");
|
int colNWT = getItemCol(cell, startRow - 1, L"¾»ÖØ,¾»ÖØ(KG)");
|
int colVolDesc = getItemCol(cell, startRow - 1, L"Ìå»ýÃèÊö,³¤X¿íX¸ß,³¤X¿íX¸ß(CM)");
|
int colVol = getItemCol(cell, startRow - 1, L"Ìå»ý,Ìå»ý(M3)");
|
int col40HQ = getItemCol(cell, startRow - 1, L"40HQ,QTY(40HQ)");
|
|
int colSupplier1 = getItemCol(cell, startRow - 1, L"¹©Ó¦ÉÌ1");
|
int colSupplier = getItemCol(cell, startRow - 1, L"¹©Ó¦ÉÌ");
|
int colPOPrice1 = getItemCol(cell, startRow - 1, L"¼Û¸ñ1");
|
int colPOPrice = getItemCol(cell, startRow - 1, L"¼Û¸ñ");
|
|
int colInnerOuter = getItemCol(cell, startRow - 1, L"×°ÏäÊý(ÄÚ/Íâ)");
|
int colItemQty = getItemCol(cell, startRow - 1, L"ÊýÁ¿,Qty");
|
int colPackage = getItemCol(cell, startRow - 1, L"Package,°ü×°·½Ê½");
|
int colBuyer = getItemCol(cell, startRow - 1, L"²É¹ºÈËÔ±");
|
int colRemark = getItemCol(cell, startRow - 1, L"Remarks");
|
int colFOBPrice = getItemCol(cell, startRow - 1, L"FOB Price,FOB Price(USD),Fob Price");
|
|
|
int LastRow = cell.GetValidRow();
|
xstring sdate = publiccode::GetCurrentDate();
|
|
xstring rowid = L"";
|
for (int row = startRow; row <= LastRow; row++)
|
{
|
bool bextern = false;
|
if (cell.GetItemString(row, colItemName) == L"" &&
|
cell.GetItemString(row, colItemSpec) == L"")
|
{
|
|
}
|
|
xstring itemStr = L"";
|
rowid = getRowID(cell, row);
|
itemStr += L"<RowID>" + getRowID(cell, row) + L"</RowID>";
|
itemStr += L"<SKUID>" + cell.GetItemString(row, colSKUID) + L"</SKUID>";
|
itemStr += L"<customer-photo>" + getRowTerm(cell, row, L"customer-photo") + L"</customer-photo>";
|
itemStr += L"<supplier-photo>" + getRowTerm(cell, row, L"supplier-photo") + L"</supplier-photo>";
|
itemStr += L"<customer-photo-url>" + getImageList(getRowTerm(cell, row, L"customer-photo")) + L"</customer-photo-url>";
|
itemStr += L"<supplier-photo-url>" + getImageList(getRowTerm(cell, row, L"supplier-photo")) + L"</supplier-photo-url>";
|
itemStr += L"<ItemNo>" + cell.GetItemString(row, colItemNo) + L"</ItemNo>";
|
itemStr += L"<CustomItemNo>" + cell.GetItemString(row, colCustomerItemNo) + L"</CustomItemNo>";
|
itemStr += L"<ItemName>" + cell.GetItemString(row, colItemName) + L"</ItemName>";
|
itemStr += L"<ItemCName>" + cell.GetItemString(row, colItemCName) + L"</ItemCName>";
|
itemStr += L"<ItemSpec>" + cell.GetItemString(row, colItemSpec) + L"</ItemSpec>";
|
itemStr += L"<CustomerImage>" + cell.GetItemString(row, colCustomerImage) + L"</CustomerImage>";
|
itemStr += L"<BuyerPrice>" + cell.GetItemString(row, colBuyerPrice) + L"</BuyerPrice>";
|
itemStr += L"<SaleRemark>" + cell.GetItemString(row, colSaleRemark) + L"</SaleRemark>";
|
|
itemStr += L"<BuyerMOQ>" + cell.GetItemString(row, colBuyerMOQ) + L"</BuyerMOQ>";
|
itemStr += L"<BuyerRemark>" + cell.GetItemString(row, colBuyerRemark) + L"</BuyerRemark>";
|
itemStr += L"<FactoryImage>" + cell.GetItemString(row, colFactoryImage) + L"</FactoryImage>";
|
itemStr += L"<GWT>" + cell.GetItemString(row, colGWT) + L"</GWT>";
|
itemStr += L"<NWT>" + cell.GetItemString(row, colNWT) + L"</NWT>";
|
itemStr += L"<VolDesc>" + cell.GetItemString(row, colVolDesc) + L"</VolDesc>";
|
itemStr += L"<Vol>" + cell.GetItemString(row, colVol) + L"</Vol>";
|
itemStr += L"<F40HQ>" + cell.GetItemString(row, col40HQ) + L"</F40HQ>";
|
itemStr += L"<Packing>" + cell.GetItemString(row, colInnerOuter) + L"</Packing>";
|
itemStr += L"<Quantity>" + cell.GetItemString(row, colItemQty) + L"</Quantity>";
|
itemStr += L"<Package>" + cell.GetItemString(row, colPackage) + L"</Package>";
|
itemStr += L"<Buyer>" + cell.GetItemString(row, colBuyer) + L"</Buyer>";
|
itemStr += L"<RemarkS>" + cell.GetItemString(row, colRemark) + L"</RemarkS>";
|
itemStr += L"<FOBPrice>" + cell.GetItemString(row, colFOBPrice) + L"</FOBPrice>";
|
|
|
itemStr += L"<PurchedDate>" + sdate + L"</PurchedDate>";
|
itemStr += L"<EnquiryLineID>" + getRowTerm(dw_cell, row, L"EnquiryLineID") + L"</EnquiryLineID>";
|
content += L"<Item>" + itemStr + L"</Item>";
|
}
|
content = L"<data>" + base + content + L"</data>";
|
|
return content;
|
}
|
|
xstring GetSaleFullData(xcell cell, KXMLDOMNodeList ts)
|
{
|
xstring content = L"";
|
xstring base = L"";
|
base += L"<QuoteNo>" + getBaseItem(cell, L"±¨¼Ûµ¥ºÅ:") + L"</QuoteNo>";
|
base += L"<ExpDate>" + getBaseItem(cell, L"±¨¼Û½ØÖ¹ÈÕÆÚ£º") + L"</ExpDate>";
|
base += L"<PrjName>" + getBaseItem(cell, L"ÏîÄ¿Ãû³Æ:") + L"</PrjName>";
|
base += L"<QuoteDate>" + dw_base.GetItemString(1, L"QuoteDate") + L"</QuoteDate>";
|
|
int startRow = getItemHeadRow(cell);
|
|
//ûÓÐÕÒµ½ÉÌÆ·ÐеıêÌâ
|
if (startRow < 1) return L"";
|
startRow++;
|
|
int colItemNo = getItemCol(cell, startRow - 1, L"ÎÒ˾ÐͺÅ,ItemNo");
|
int colCustomerItemNo = getItemCol(cell, startRow - 1, L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(cell, startRow - 1, L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(cell, startRow - 1, L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(cell, startRow - 1, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colBuyerPrice = getItemCol(cell, startRow - 1, L"²É¹º¼Û,²É¹º¼Û¸ñ");
|
int colCustomerImage = getItemCol(cell, startRow - 1, L"Photo,ͼƬ");
|
int colSKUID = getItemCol(cell, startRow - 1, L"SKUID");
|
int colSaleRemark = getItemCol(cell, startRow - 1, L"ÒµÎñTo²É¹º±¸×¢");
|
|
int colBuyerMOQ = getItemCol(cell, startRow - 1, L"MOQ");
|
int colBuyerRemark = getItemCol(cell, startRow - 1, L"²É¹ºToÒµÎñ±¸×¢");
|
int colFactoryImage = getItemCol(cell, startRow - 1, L"¹¤³§Í¼Æ¬");
|
int colGWT = getItemCol(cell, startRow - 1, L"Ã«ÖØ,Ã«ÖØ(KG)");
|
int colNWT = getItemCol(cell, startRow - 1, L"¾»ÖØ,¾»ÖØ(KG)");
|
int colVolDesc = getItemCol(cell, startRow - 1, L"Ìå»ýÃèÊö,³¤X¿íX¸ß,³¤X¿íX¸ß(CM)");
|
int colVol = getItemCol(cell, startRow - 1, L"Ìå»ý,Ìå»ý(M3)");
|
int col40HQ = getItemCol(cell, startRow - 1, L"40HQ,QTY(40HQ)");
|
|
int colPOPrice = getItemCol(cell, startRow - 1, L"¼Û¸ñ");
|
int colSupplier = getItemCol(cell, startRow - 1, L"¹©Ó¦ÉÌ");
|
int colPOPrice1 = getItemCol(cell, startRow - 1, L"¼Û¸ñ1");
|
int colSupplier1 = getItemCol(cell, startRow - 1, L"¹©Ó¦ÉÌ1");
|
int colPOPrice2 = getItemCol(cell, startRow - 1, L"¼Û¸ñ2");
|
int colSupplier2 = getItemCol(cell, startRow - 1, L"¹©Ó¦ÉÌ2");
|
int colPOPrice3 = getItemCol(cell, startRow - 1, L"¼Û¸ñ3");
|
int colSupplier3 = getItemCol(cell, startRow - 1, L"¹©Ó¦ÉÌ3");
|
int colBOMType = getItemCol(cell, startRow - 1, L"ÀàÐÍ");
|
int colBOMType1 = getItemCol(cell, startRow - 1, L"ÀàÐÍ1");
|
int colBOMType2 = getItemCol(cell, startRow - 1, L"ÀàÐÍ2");
|
int colBOMType3 = getItemCol(cell, startRow - 1, L"ÀàÐÍ3");
|
|
int colInnerOuter = getItemCol(cell, startRow - 1, L"×°ÏäÊý(ÄÚ/Íâ)");
|
int colItemQty = getItemCol(cell, startRow - 1, L"ÊýÁ¿,Qty");
|
int colPackage = getItemCol(cell, startRow - 1, L"Package,°ü×°·½Ê½");
|
int colBuyer = getItemCol(cell, startRow - 1, L"²É¹ºÈËÔ±");
|
int colRemark = getItemCol(cell, startRow - 1, L"Remarks");
|
int colFOBPrice = getItemCol(cell, startRow - 1, L"FOB Price,FOB Price(USD),Fob Price");
|
|
|
int LastRow = cell.GetValidRow();
|
xstring sdate = publiccode::GetCurrentDate();
|
|
int len = ts.length();
|
|
//xstring content = L"";
|
//xstring sdate = publiccode::GetCurrentDate();
|
for (int k = 0; k < len; k++)
|
{
|
KXMLDOMNode node = ts.item(k);
|
xstring id = node.selectSingleNode(L"RowID").text();
|
int row = LookupCellRow(id);
|
if (row < 1) continue;
|
|
xstring itemStr = L"";
|
itemStr += L"<RowID>" + getRowID(cell, row) + L"</RowID>";
|
itemStr += L"<SKUID>" + cell.GetItemString(row, colSKUID) + L"</SKUID>";
|
itemStr += L"<customer-photo>" + getRowTerm(cell, row, L"customer-photo") + L"</customer-photo>";
|
itemStr += L"<supplier-photo>" + getRowTerm(cell, row, L"supplier-photo") + L"</supplier-photo>";
|
itemStr += L"<ItemNo>" + cell.GetItemString(row, colItemNo) + L"</ItemNo>";
|
itemStr += L"<CustomItemNo>" + cell.GetItemString(row, colCustomerItemNo) + L"</CustomItemNo>";
|
itemStr += L"<ItemName>" + cell.GetItemString(row, colItemName) + L"</ItemName>";
|
itemStr += L"<ItemCName>" + cell.GetItemString(row, colItemCName) + L"</ItemCName>";
|
itemStr += L"<ItemSpec>" + cell.GetItemString(row, colItemSpec) + L"</ItemSpec>";
|
itemStr += L"<CustomerImage>" + cell.GetItemString(row, colCustomerImage) + L"</CustomerImage>";
|
itemStr += L"<BuyerPrice>" + cell.GetItemString(row, colBuyerPrice) + L"</BuyerPrice>";
|
itemStr += L"<SaleRemark>" + cell.GetItemString(row, colSaleRemark) + L"</SaleRemark>";
|
|
itemStr += L"<BuyerMOQ>" + cell.GetItemString(row, colBuyerMOQ) + L"</BuyerMOQ>";
|
itemStr += L"<BuyerRemark>" + cell.GetItemString(row, colBuyerRemark) + L"</BuyerRemark>";
|
itemStr += L"<FactoryImage>" + cell.GetItemString(row, colFactoryImage) + L"</FactoryImage>";
|
itemStr += L"<GWT>" + cell.GetItemString(row, colGWT) + L"</GWT>";
|
itemStr += L"<NWT>" + cell.GetItemString(row, colNWT) + L"</NWT>";
|
itemStr += L"<VolDesc>" + cell.GetItemString(row, colVolDesc) + L"</VolDesc>";
|
itemStr += L"<Vol>" + cell.GetItemString(row, colVol) + L"</Vol>";
|
itemStr += L"<F40HQ>" + cell.GetItemString(row, col40HQ) + L"</F40HQ>";
|
itemStr += L"<Packing>" + cell.GetItemString(row, colInnerOuter) + L"</Packing>";
|
itemStr += L"<Quantity>" + cell.GetItemString(row, colItemQty) + L"</Quantity>";
|
itemStr += L"<Package>" + cell.GetItemString(row, colPackage) + L"</Package>";
|
itemStr += L"<Buyer>" + cell.GetItemString(row, colBuyer) + L"</Buyer>";
|
itemStr += L"<RemarkS>" + cell.GetItemString(row, colRemark) + L"</RemarkS>";
|
itemStr += L"<FOBPrice>" + cell.GetItemString(row, colFOBPrice) + L"</FOBPrice>";
|
|
itemStr += L"<Supplier>" + cell.GetItemString(row, colSupplier) + L"</Supplier>";
|
itemStr += L"<Supplier1>" + cell.GetItemString(row, colSupplier1) + L"</Supplier1>";
|
itemStr += L"<Supplier2>" + cell.GetItemString(row, colSupplier2) + L"</Supplier2>";
|
itemStr += L"<Supplier3>" + cell.GetItemString(row, colSupplier3) + L"</Supplier3>";
|
itemStr += L"<POPrice>" + cell.GetItemString(row, colPOPrice) + L"</POPrice>";
|
itemStr += L"<POPrice1>" + cell.GetItemString(row, colPOPrice1) + L"</POPrice1>";
|
itemStr += L"<POPrice2>" + cell.GetItemString(row, colPOPrice2) + L"</POPrice2>";
|
itemStr += L"<POPrice3>" + cell.GetItemString(row, colPOPrice3) + L"</POPrice3>";
|
|
itemStr += L"<BOMType>" + cell.GetItemString(row, colBOMType) + L"</BOMType>";
|
itemStr += L"<BOMType1>" + cell.GetItemString(row, colBOMType1) + L"</BOMType1>";
|
itemStr += L"<BOMType2>" + cell.GetItemString(row, colBOMType2) + L"</BOMType2>";
|
itemStr += L"<BOMType3>" + cell.GetItemString(row, colBOMType2) + L"</BOMType3>";
|
itemStr += L"<PurchedDate>" + sdate + L"</PurchedDate>";
|
itemStr += L"<EnquiryLineID>" + getRowTerm(cell, row, L"EnquiryLineID") + L"</EnquiryLineID>";
|
|
int lastrow = row;
|
|
while (true)
|
{
|
row++;
|
if (cell.GetItemString(row, colItemName) != L"" || cell.GetItemString(row, colItemSpec) != L"") break;
|
if (cell.GetItemString(row, colSupplier) == L"")break;
|
xstring extStr = L"";
|
extStr += L"<Supplier>" + cell.GetItemString(row, colSupplier) + L"</Supplier>";
|
extStr += L"<Supplier1>" + cell.GetItemString(row, colSupplier1) + L"</Supplier1>";
|
extStr += L"<Supplier2>" + cell.GetItemString(row, colSupplier2) + L"</Supplier2>";
|
extStr += L"<Supplier3>" + cell.GetItemString(row, colSupplier3) + L"</Supplier3>";
|
extStr += L"<POPrice>" + cell.GetItemString(row, colPOPrice) + L"</POPrice>";
|
extStr += L"<POPrice1>" + cell.GetItemString(row, colPOPrice1) + L"</POPrice1>";
|
extStr += L"<POPrice2>" + cell.GetItemString(row, colPOPrice2) + L"</POPrice2>";
|
extStr += L"<POPrice3>" + cell.GetItemString(row, colPOPrice3) + L"</POPrice3>";
|
|
extStr += L"<BOMType>" + cell.GetItemString(row, colBOMType) + L"</BOMType>";
|
extStr += L"<BOMType1>" + cell.GetItemString(row, colBOMType1) + L"</BOMType1>";
|
extStr += L"<BOMType2>" + cell.GetItemString(row, colBOMType2) + L"</BOMType2>";
|
extStr += L"<BOMType3>" + cell.GetItemString(row, colBOMType2) + L"</BOMType3>";
|
|
itemStr += L"<ExtItem>" + extStr + L"</ExtItem>"; //±¸ÓòɹºÐÅÏ¢
|
xstring eid = GetGuid();
|
setRowTerm(cell, row, L"EnquiryLineID", eid);
|
itemStr += L"<EnquiryLineID>" + getRowTerm(cell, row, L"EnquiryLineID") + L"</EnquiryLineID>";
|
}
|
content += L"<Item>" + itemStr + L"</Item>";
|
}
|
content = L"<data>" + base + content + L"</data>";
|
|
return content;
|
}
|
|
int OnPrint()
|
{
|
|
if (dw_base.GetItemString(1, L"QuoteNo") == L"")
|
{
|
alert(L"ÇëÏȱ£´æÊý¾Ý!");
|
return 1;
|
}
|
|
xaserverarg argx;
|
argx.AddArg(L"QuoteNo", dw_base.GetItemString(1, L"QuoteNo"));
|
if (dw_base.GetItemString(1, L"QuoteNo") != L"")
|
{
|
OpenWindow(L"dev:xpage[xmQuoteBillList.vx]", argx);
|
}
|
if (argx.GetArgString(L"action") != L"ok") return 1;
|
|
xstring printStr = argx.GetArgString(L"items");
|
|
xaserverarg arg ;
|
|
arg.AddArg(L"DataUrl", L"/sale/data/Quote3/print/mydata");
|
arg.AddArg(L"EntityName", L"Quote");
|
arg.AddArg(L"EntityID", entityID + printStr);
|
arg.AddArg(L"EntityNo", dw_base.GetItemString(1, L"QuoteNo"));
|
trace(L"*******" + entityID + printStr + L"*******");
|
openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", &arg);
|
|
/* xaserverarg arg=new xaserverarg;
|
|
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 RowChanged(int row)
|
{
|
ximageview im = GetControl(L"frame:im1");
|
im.Reset();
|
|
int startRow = getItemHeadRow(dw_cell);
|
//ûÓÐÕÒµ½ÉÌÆ·ÐеıêÌâ
|
if (startRow < 1) return 1;
|
if (row <= startRow) return 1;
|
|
int colCustomerPhoto = getItemCol(dw_cell, startRow, L"Photo,Customer Photo");
|
xstring ls_photo = dw_cell.GetItemString(row, colCustomerPhoto);
|
while (ls_photo == L"-")
|
{
|
if (row - 1 < startRow) break;
|
row = row - 1;
|
ls_photo = dw_cell.GetItemString(row, colCustomerPhoto);
|
}
|
if (row <= startRow) return 1;
|
|
xstring str = dw_cell.GetItemString(row, 0);
|
ShowImage(str, L"customer-photo");
|
ShowImage(str, L"supplier-photo");
|
|
im.Redraw();
|
|
return 1;
|
}
|
|
xstring getBaseItem(xcell dw_cell, xstring colname)
|
{
|
int row = 0;
|
int col = 0;
|
int vcol = 0;
|
int vrow = dw_cell.GetValidRow();
|
int scol = dw_cell.GetValidCol();
|
for (row = 1; row <= vrow; row++)
|
{
|
vcol = dw_cell.GetValidCol(row);
|
if (vcol < scol) vcol++;
|
for (col = 1; col <= vcol; col++)
|
{
|
if (dw_cell.GetItemString(row, col) == colname)
|
{
|
return dw_cell.GetItemString(row, col + 1);
|
}
|
}
|
}
|
return L"";
|
}
|
|
void setBaseItem(xcell dw_cell, xstring colname, xstring val)
|
{
|
int row = 0;
|
int col = 0;
|
int vcol = 0;
|
int vrow = dw_cell.GetValidRow();
|
int scol = dw_cell.GetValidCol();
|
for (row = 1; row <= vrow; row++)
|
{
|
vcol = dw_cell.GetValidCol(row);
|
if (vcol < scol) vcol++;
|
for (col = 1; col <= vcol; col++)
|
{
|
if (dw_cell.GetItemString(row, col) == colname)
|
{
|
dw_cell.SetItemString(row, col + 1, val);
|
dw_cell.Redraw();
|
}
|
}
|
}
|
}
|
|
int getItemCol(xcell dw_obj, int row, xstring head)
|
{
|
xstring fullhead = L"," + head + L",";
|
int headRow = row;
|
int colCount = dw_obj.GetValidCol(headRow);
|
for (int col = 1; col <= colCount; col++)
|
{
|
if (fullhead.find(L"," + dw_obj.GetItemString(headRow, col) + L",") >= 0) return col;
|
}
|
return -1;
|
}
|
|
|
int setRowProp(xcell dw_obj, int row, xstring prop, xstring val)
|
{
|
prop = prop.trim();
|
if (prop.left(1) != L"[") prop = L"[" + prop + L"]";
|
xstring str = dw_obj.GetItemString(row, 0);
|
if (str.find(prop + L":" + val + L";") >= 0) return 1;
|
|
if (str.find(prop + L":") < 0)
|
{
|
if (str == L"")
|
str = prop + L":" + val + L";";
|
else
|
str += prop + L":" + val + L";";
|
dw_obj.SetItemString(row, 0, str);
|
}
|
else
|
{
|
str = str.mid(str.find(prop + L":") + prop.length() + 1, 9999);
|
xstring right = L"";
|
xstring left = str.left(str.find(prop + L":") + prop.length() + 1);
|
if (str.find(L";") >= 0)
|
right = str.mid(str.find(L";") + 1, 9999);
|
else if (str.find(L",") >= 0)
|
right = str.mid(str.find(L",") + 1, 9999);
|
str = left + val + L";" + right;
|
//alert(str);
|
dw_obj.SetItemString(row, 0, str);
|
}
|
return 1;
|
}
|
|
xstring getRowProp(xcell dw_obj, int row, xstring prop)
|
{
|
prop = prop.trim();
|
if (prop.left(1) != L"[") prop = L"[" + prop + L"]";
|
xstring str = dw_obj.GetItemString(row, 0);
|
if (str.find(prop + L":") >= 0)
|
{
|
str = str.mid(str.find(prop + L":") + prop.length() + 1, 9999);
|
if (str.find(L";") >= 0)
|
str = str.left(str.find(L";"));
|
else if (str.find(L",") >= 0)
|
str = str.left(str.find(L","));
|
return str;
|
}
|
return L"";
|
}
|
|
int ensureRowID()
|
{
|
int startRow = getItemHeadRow(dw_cell);
|
//ûÓÐÕÒµ½ÉÌÆ·ÐеıêÌâ
|
if (startRow < 1) return 0;
|
startRow++;
|
|
int colItemNo = getItemCol(dw_cell, startRow - 1, L"ÎÒ˾ÐͺÅ,ItemNo");
|
int colCustomerItemNo = getItemCol(dw_cell, startRow - 1, L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(dw_cell, startRow - 1, L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(dw_cell, startRow - 1, L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(dw_cell, startRow - 1, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colBuyerPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û,²É¹º¼Û¸ñ");
|
|
int LastRow = dw_cell.GetValidRow();
|
for (int row = startRow; row <= LastRow; row++)
|
{
|
if (dw_cell.GetItemString(row, colItemName) == L"" &&
|
dw_cell.GetItemString(row, colItemCName) == L"") break;
|
ensureRowID(dw_cell, row);
|
}
|
return 1;
|
}
|
|
int LookupRow(xstring rowid)
|
{
|
int rowcount = dw_goods.GetRowCount();
|
for (int row = 1; row <= rowcount; row++)
|
{
|
if (dw_goods.GetGuid(row) == rowid) return row;
|
}
|
return 0;
|
}
|
|
int LookupCellRow(xcell cell, xstring rowid)
|
{
|
int startRow = getItemHeadRow(cell);
|
//ûÓÐÕÒµ½ÉÌÆ·ÐеıêÌâ
|
if (startRow < 1) return 0;
|
startRow++;
|
|
int LastRow = cell.GetValidRow();
|
for (int row = startRow; row <= LastRow; row++)
|
{
|
if (getRowID(cell, row) == rowid) return row;
|
}
|
return 0;
|
}
|
|
int LookupCellRow(xstring rowid)
|
{
|
return LookupCellRow(dw_cell, rowid);
|
}
|
|
int ensureRowID(xcell dw_obj, int row)
|
{
|
xstring str = dw_obj.GetItemString(row, 0);
|
if (str.find(L"rowid:") < 0)
|
{
|
xstring rowid = ViewObject::GetGuid();
|
if (str == L"")
|
str = L"rowid:" + rowid + L";";
|
else
|
str += L";rowid:" + rowid + L";";
|
//alert(str);
|
dw_obj.SetItemString(row, 0, str);
|
}
|
return 1;
|
}
|
|
xstring getRowID(xcell dw_obj, int row)
|
{
|
xstring str = dw_obj.GetItemString(row, 0);
|
if (str.find(L"rowid:") >= 0)
|
{
|
str = str.mid(str.find(L"rowid:") + 6, 99999);
|
if (str.find(L";") >= 0)
|
str = str.left(str.find(L";"));
|
else if (str.find(L",") >= 0)
|
str = str.left(str.find(L","));
|
return str;
|
}
|
return L"";
|
}
|
|
xstring getRowTerm(xcell dw_obj, int row, xstring tm)
|
{
|
xstring str = dw_obj.GetItemString(row, 0);
|
if (str.find(tm + L":") >= 0)
|
{
|
str = str.mid(str.find(tm + L":") + tm.length() + 1, 99999);
|
if (str.find(L";") >= 0) str = str.left(str.find(L";"));
|
return str;
|
}
|
return L"";
|
}
|
|
int setRowTerm(xcell dw_obj, int row, xstring tm, xstring val)
|
{
|
xstring str = dw_obj.GetItemString(row, 0);
|
if (str.find(tm + L":") >= 0)
|
{
|
int pos0 = str.find(tm + L":");
|
xstring left = str.left(pos0);
|
if (left != L"" && left.right(1) != L";") left += L";";
|
|
xstring right = L"";
|
int pos1 = str.find(L";", pos0 + 1);
|
if (pos1 >= 0)right = str.mid(pos1, 99999);
|
str = left + tm + L":" + val + right;
|
}
|
else
|
{
|
if (str.right(1) == L";")
|
str += tm + L":" + val;
|
else
|
str += L";" + tm + L":" + val;
|
}
|
trace(L"\r\nterm:" + str + L"\r\n");
|
dw_obj.SetItemString(row, 0, str);
|
return 1;
|
}
|
|
int resetRowTerm(xcell dw_obj, int row, xstring tm)
|
{
|
xstring str = dw_obj.GetItemString(row, 0);
|
if (str.find(tm + L":") >= 0)
|
{
|
int pos0 = str.find(tm + L":");
|
xstring left = str.left(pos0);
|
if (left != L"" && left.right(1) != L";") left += L";";
|
|
xstring right = L"";
|
int pos1 = str.find(L";", pos0 + 1);
|
if (pos1 >= 0)right = str.mid(pos1, 99999);
|
str = left + right;
|
}
|
dw_obj.SetItemString(row, 0, str);
|
return 1;
|
}
|
|
//Éú³É·µ»ØÏúÊÛÈËÔ±µÄ²É¹º²úÆ·ÐÅÏ¢
|
xstring makeMessageBacktoSaler(xstring myurl)
|
{
|
int startRow = getItemHeadRow(dw_cell);
|
|
//ûÓÐÕÒµ½ÉÌÆ·ÐеıêÌâ
|
if (startRow < 1) return L"";
|
startRow++;
|
|
int colItemNo = getItemCol(dw_cell, startRow - 1, L"ÎÒ˾ÐͺÅ,ItemNo");
|
int colCustomerItemNo = getItemCol(dw_cell, startRow - 1, L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(dw_cell, startRow - 1, L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(dw_cell, startRow - 1, L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(dw_cell, startRow - 1, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colBuyerPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û,²É¹º¼Û¸ñ");
|
|
int colBuyerMOQ = getItemCol(dw_cell, startRow - 1, L"MOQ");
|
int colBuyerRemark = getItemCol(dw_cell, startRow - 1, L"²É¹ºToÒµÎñ±¸×¢");
|
int colFactoryImage = getItemCol(dw_cell, startRow - 1, L"¹¤³§Í¼Æ¬");
|
int colGWT = getItemCol(dw_cell, startRow - 1, L"Ã«ÖØ,Ã«ÖØ(KG)");
|
int colNWT = getItemCol(dw_cell, startRow - 1, L"¾»ÖØ,¾»ÖØ(KG)");
|
int colVolDesc = getItemCol(dw_cell, startRow - 1, L"Ìå»ýÃèÊö,³¤X¿íX¸ß,³¤X¿íX¸ß(CM)");
|
int colVol = getItemCol(dw_cell, startRow - 1, L"Ìå»ý,Ìå»ý(M3)");
|
int col40HQ = getItemCol(dw_cell, startRow - 1, L"40HQ,QTY(40HQ)");
|
|
int colSupplier = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ");
|
int colSupplier1 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ1");
|
int colPOPrice = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ");
|
int colPOPrice1 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ1");
|
int colProductInfo = getItemCol(dw_cell, startRow - 1, L"ÒµÎñ²¿²úÆ·ÐÅÏ¢");
|
int colProductInfo1 = getItemCol(dw_cell, startRow - 1, L"²É¹º²¿²úÆ·ÐÅÏ¢");
|
|
int LastRow = dw_cell.GetValidRow();
|
xstring content = L"";
|
|
xstring sdate = publiccode::GetCurrentDate();
|
for (int row = startRow; row <= LastRow; row++)
|
{
|
if (dw_cell.GetItemString(row, colItemName) == L"" &&
|
dw_cell.GetItemString(row, colItemSpec) == L"") break;
|
|
xstring itemStr = L"";
|
itemStr += L"<RowID>" + getRowID(dw_cell, row) + L"</RowID>";
|
itemStr += L"<ItemNo>" + dw_cell.GetItemString(row, colItemNo) + L"</ItemNo>";
|
itemStr += L"<CustomerItemNo>" + dw_cell.GetItemString(row, colCustomerItemNo) + L"</CustomerItemNo>";
|
itemStr += L"<ItemName>" + dw_cell.GetItemString(row, colItemName) + L"</ItemName>";
|
itemStr += L"<ItemCName>" + dw_cell.GetItemString(row, colItemCName) + L"</ItemCName>";
|
itemStr += L"<ItemSpec>" + dw_cell.GetItemString(row, colItemSpec) + L"</ItemSpec>";
|
itemStr += L"<BuyerPrice>" + dw_cell.GetItemString(row, colBuyerPrice) + L"</BuyerPrice>";
|
itemStr += L"<ProductInfo>" + dw_cell.GetItemString(row, colProductInfo) + L"</ProductInfo>";
|
itemStr += L"<ProductInfo1>" + dw_cell.GetItemString(row, colProductInfo1) + L"</ProductInfo1>";
|
|
if (dw_cell.GetItemString(row, colBuyerPrice) == L"") return L"²É¹º¼Û¸ñûÓмÈë";
|
if (dw_cell.GetItemString(row, colGWT) == L"") return L"Ã«ÖØÃ»ÓмÈë";
|
if (dw_cell.GetItemString(row, colNWT) == L"") return L"¾»ÖØÃ»ÓмÈë";
|
if (dw_cell.GetItemString(row, colVolDesc) == L"") return L"³¤X¿íX¸ßûÓмÈë";
|
if (dw_cell.GetItemString(row, colFactoryImage) == L"") return L"ͼƬûÓмÈë";
|
|
if (dw_cell.GetItemString(row, colSupplier) == L"")return L"¹©Ó¦ÉÌûÓмÈë";
|
if (dw_cell.GetItemString(row, colPOPrice) == L"")return L"²É¹º¼Û¸ñûÓмÈë";
|
|
if (dw_cell.GetItemString(row, colPOPrice1) != L"")
|
{
|
if (dw_cell.GetItemString(row, colSupplier1) == L"") return L"¹©Ó¦ÉÌ1ûÓмÈë";
|
}
|
if (dw_cell.GetItemString(row, colSupplier1) != L"")
|
{
|
if (dw_cell.GetItemString(row, colPOPrice1) == L"") return L"²É¹º¼Û¸ñ1ûÓмÈë";
|
}
|
itemStr += L"<BuyerMOQ>" + dw_cell.GetItemString(row, colBuyerMOQ) + L"</BuyerMOQ>";
|
itemStr += L"<BuyerRemark>" + dw_cell.GetItemString(row, colBuyerRemark) + L"</BuyerRemark>";
|
itemStr += L"<FactoryImage>" + dw_cell.GetItemString(row, colFactoryImage) + L"</FactoryImage>";
|
itemStr += L"<GWT>" + dw_cell.GetItemString(row, colGWT) + L"</GWT>";
|
itemStr += L"<NWT>" + dw_cell.GetItemString(row, colNWT) + L"</NWT>";
|
itemStr += L"<VolDesc>" + dw_cell.GetItemString(row, colVolDesc) + L"</VolDesc>";
|
itemStr += L"<Vol>" + dw_cell.GetItemString(row, colVol) + L"</Vol>";
|
itemStr += L"<F40HQ>" + dw_cell.GetItemString(row, col40HQ) + L"</F40HQ>";
|
|
itemStr += L"<PurchedDate>" + sdate + L"</PurchedDate>";
|
itemStr += L"<EnquiryLineID>" + getRowTerm(dw_cell, row, L"EnquiryLineID") + L"</EnquiryLineID>";
|
content += L"<Item>" + itemStr + L"</Item>";
|
}
|
xstring newEntityItemID = ViewObject::GetGuid();
|
content = L"<data id='" + entityID + L"' itemid='" + newEntityItemID + L"' action='purched'>" + content + L"</data>";
|
|
return content;
|
}
|
|
int ProcessSendMessage(xstring myurl, xstring param, xstring content, xstring datacontent, bool balert = false)
|
{
|
xaserverarg arg ;
|
|
arg.AddArg(L"myurl", myurl);
|
arg.AddArg(L"param", param);
|
arg.AddArg(L"content", content);
|
arg.AddArg(L"datacontent", datacontent);
|
|
//trace(content);
|
|
xml x ;
|
|
if (xurl::get(L"/sale/data/Thing/business/message/add", arg.GetString(), x) != 1)
|
{
|
xstring error = x.text();
|
if (balert)alert((xstring)L"error:" + x.xml());
|
trace(error);
|
return -1;
|
}
|
else
|
{
|
//trace(x.xml());
|
if (balert)
|
alert(x.text());
|
}
|
return 1;
|
}
|
|
int makeMessage(xstring myurl)
|
{
|
if (myurl == L"/task/quote/purchar/backtosaler")
|
{
|
xstring content = makeMessageBacktoSaler(myurl);
|
xstring datacontent = GetSaleFullData(dw_cell);
|
if (content.left(1) != L"<")
|
{
|
alert(content);
|
return 1;
|
}
|
if (content != L"") return ProcessSendMessage(myurl, L"", content, datacontent, true);
|
return 1;
|
}
|
return 1;
|
}
|
|
int SendToPurcher(xstring purchor, xstring content)
|
{
|
xstring empno;
|
KXMLDOMNode n = purcher.selectSingleNode(L"//HrEmployee[Name='" + purchor + L"']/UserNo");
|
if (n)empno = n.text();
|
if (empno == L"") return 1;
|
//trace(L"\r\npurchor:"+empno);
|
|
xstring newItemID = ViewObject::GetGuid();
|
xstring business = L"";
|
content = content.mid(content.find(L"<xsheet"), 9999999);
|
business = L"<business action='purch' id='" + entityID + L"' itemid='" + newItemID + L"' processurl='" + processurl + L"' purchor.name='" + purchor + L"' purchor.no='" + empno + L"' termid='" + templateID + L"'>";
|
business += L"<content>" + content + L"</content></business>";
|
|
xcell dw_cell1 = GetControl(L"dw_cell1");
|
xstring datacontent = GetSaleFullData(dw_cell1);
|
|
//trace(datacontent);
|
int ret = ProcessSendMessage(L"/task/quote/purch", L"", business, datacontent, true);
|
return ret;
|
|
/*
|
//ThingImpl:AddTask1($FlowID,$EntityID,$EntityNo,$Subject, $Content,$Status, $Category,$Reciever)
|
xml x ;
|
|
xaserverarg arg ;
|
|
|
xstring empno;
|
KXMLDOMNode n = purcher.selectSingleNode(L"//HrEmployee[Name='"+purchor+L"']/UserNo");
|
if(n)empno=n.text();
|
if(empno==L"") return 1;
|
trace(L"\r\npurchor:"+empno);
|
|
arg.AddArg(L"FlowID",L"DCC32D5B-9FCD-4F53-B7CF-630441DE2B47");
|
arg.AddArg(L"EntityID",fileid);
|
//arg.AddArg(L"EntityID",L"DCC32D5B-9FCD-4F53-B7CF-630441DE2B47");
|
arg.AddArg(L"EntityNo",L"²âÊÔ");
|
arg.AddArg(L"Subject",L"---²âÊÔÊý¾Ý----:ѯÒÔϲúÆ·¼Û¸ñ");
|
arg.AddArg(L"Content",content);
|
arg.AddArg(L"Status",L"²É¹ºÑ¯¼Û");
|
arg.AddArg(L"Category",L"QuoteEnquiry");
|
arg.AddArg(L"Reciever",empno+L"|admin|00601");
|
|
xstring path=L"/sale/data/Thing/task/add/content1";
|
if (xurl::get(path,arg.GetString(),x) != 1)
|
{
|
alert(L"·¢Ëͳö´íÁË!");
|
return -1;
|
}else
|
{
|
if(x.xml().find(L"error")>=0)
|
{
|
alert(L"·¢Ëͳö´íÁË!"+x.xml());
|
return -1;
|
}
|
trace(x.xml());
|
}
|
trace(L"\r\n"+L"ѯ¼Ûµ¥ÒÑ·¢Ë͸ø"+purchor);
|
|
return 1;
|
*/
|
}
|
|
xstring GetPurchedItems()
|
{
|
int row = 1;
|
int startRow = getItemHeadRow(dw_cell);
|
if (startRow < 1) return L"<data/>";
|
startRow++;
|
|
int colItemNo = getItemCol(dw_cell, startRow - 1, L"ÎÒ˾ÐͺÅ,ItemNo");
|
int colCustomerItemNo = getItemCol(dw_cell, startRow - 1, L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(dw_cell, startRow - 1, L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(dw_cell, startRow - 1, L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(dw_cell, startRow - 1, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colBuyer = getItemCol(dw_cell, startRow - 1, L"²É¹ºÈËÔ±");
|
int colPackage = getItemCol(dw_cell, startRow - 1, L"Package,°ü×°·½Ê½");
|
int col40HQ = getItemCol(dw_cell, startRow - 1, L"40HQ,QTY(40HQ)");
|
|
int colGW = getItemCol(dw_cell, startRow - 1, L"Ã«ÖØ(KG)");
|
int colNW = getItemCol(dw_cell, startRow - 1, L"¾»ÖØ(KG)");
|
int colVolDesc = getItemCol(dw_cell, startRow - 1, L"³¤X¿íX¸ß(CM)");
|
|
int colPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û");
|
|
int colSupplier = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ");
|
int colSupplier1 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ1");
|
int colPOPrice = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ");
|
int colPOPrice1 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ1");
|
int colBOMType = getItemCol(dw_cell, startRow - 1, L"ÀàÐÍ");
|
int colBOMType1 = getItemCol(dw_cell, startRow - 1, L"ÀàÐÍ1");
|
int colProductInfo = getItemCol(dw_cell, startRow - 1, L"ÒµÎñ²¿²úÆ·ÐÅÏ¢");
|
int colProductInfo1 = getItemCol(dw_cell, startRow - 1, L"²É¹º²¿²úÆ·ÐÅÏ¢");
|
|
xstring items = L"<data>";
|
int LastRow = dw_cell.GetValidRow();
|
xstring content = L"";
|
|
for (row = startRow; row <= LastRow; row++)
|
{
|
if (dw_cell.GetItemString(row, colItemName) == L"" &&
|
dw_cell.GetItemString(row, colItemSpec) == L"") break;
|
ensureRowID(dw_cell, row);
|
|
xstring itemStr = L"";
|
xstring issend = L"1";
|
itemStr += L"<RowID>" + getRowID(dw_cell, row) + L"</RowID>";
|
itemStr += L"<ItemNo>" + dw_cell.GetItemString(row, colItemNo) + L"</ItemNo>";
|
itemStr += L"<ItemName>" + dw_cell.GetItemString(row, colItemName) + L"</ItemName>";
|
itemStr += L"<ItemCName>" + dw_cell.GetItemString(row, colItemCName) + L"</ItemCName>";
|
itemStr += L"<ItemSpec>" + dw_cell.GetItemString(row, colItemSpec) + L"</ItemSpec>";
|
itemStr += L"<RowNo>" + xstring(row - startRow + 1) + L"</RowNo>";
|
itemStr += L"<Purchor>" + dw_cell.GetItemString(row, colBuyer) + L"</Purchor>";
|
itemStr += L"<Package>" + dw_cell.GetItemString(row, colPackage) + L"</Package>";
|
itemStr += L"<NWT>" + dw_cell.GetItemString(row, colNW) + L"</NWT>";
|
itemStr += L"<GWT>" + dw_cell.GetItemString(row, colGW) + L"</GWT>";
|
itemStr += L"<VolDesc>" + dw_cell.GetItemString(row, colVolDesc) + L"</VolDesc>";
|
itemStr += L"<Supplier>" + dw_cell.GetItemString(row, colSupplier) + L"</Supplier>";
|
itemStr += L"<BuyPrice>" + dw_cell.GetItemString(row, colPOPrice) + L"</BuyPrice>";
|
itemStr += L"<Supplier1>" + dw_cell.GetItemString(row, colSupplier1) + L"</Supplier1>";
|
itemStr += L"<BuyPrice1>" + dw_cell.GetItemString(row, colPOPrice1) + L"</BuyPrice1>";
|
itemStr += L"<BOMType1>" + dw_cell.GetItemString(row, colBOMType1) + L"</BOMType1>";
|
itemStr += L"<BOMType>" + dw_cell.GetItemString(row, colBOMType) + L"</BOMType>";
|
itemStr += L"<POPrice>" + dw_cell.GetItemString(row, colPrice) + L"</POPrice>";
|
itemStr += L"<ProductInfo>" + dw_cell.GetItemString(row, colProductInfo) + L"</ProductInfo>";
|
itemStr += L"<ProductInfo1>" + dw_cell.GetItemString(row, colProductInfo1) + L"</ProductInfo1>";
|
|
if (dw_cell.GetItemString(row, colBuyer) == L"")issend = L"0";
|
itemStr += L"<IsSend>" + issend + L"</IsSend>";
|
|
items += L"<Item>" + itemStr + L"</Item>";
|
}
|
items += L"</data>";
|
|
return items;
|
}
|
|
xstring GetPurchItems()
|
{
|
int row = 1;
|
int startRow = getItemHeadRow(dw_cell);
|
if (startRow < 1) return L"<data/>";
|
startRow++;
|
|
int colItemNo = getItemCol(dw_cell, startRow - 1, L"ÎÒ˾ÐͺÅ,ItemNo");
|
int colCustomerItemNo = getItemCol(dw_cell, startRow - 1, L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(dw_cell, startRow - 1, L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(dw_cell, startRow - 1, L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(dw_cell, startRow - 1, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colBuyer = getItemCol(dw_cell, startRow - 1, L"²É¹ºÈËÔ±");
|
int colPackage = getItemCol(dw_cell, startRow - 1, L"Package,°ü×°·½Ê½");
|
int col40HQ = getItemCol(dw_cell, startRow - 1, L"40HQ,QTY(40HQ)");
|
|
int colGW = getItemCol(dw_cell, startRow - 1, L"Ã«ÖØ(KG)");
|
int colNW = getItemCol(dw_cell, startRow - 1, L"¾»ÖØ(KG)");
|
int colVolDesc = getItemCol(dw_cell, startRow - 1, L"³¤X¿íX¸ß(CM)");
|
|
int colProductInfo = getItemCol(dw_cell, startRow - 1, L"ÒµÎñ²¿²úÆ·ÐÅÏ¢");
|
int colProductInfo1 = getItemCol(dw_cell, startRow - 1, L"²É¹º²¿²úÆ·ÐÅÏ¢");
|
|
xstring items = L"<data>";
|
int LastRow = dw_cell.GetValidRow();
|
xstring content = L"";
|
|
for (row = startRow; row <= LastRow; row++)
|
{
|
if (dw_cell.GetItemString(row, colItemName) == L"" &&
|
dw_cell.GetItemString(row, colItemSpec) == L"") break;
|
ensureRowID(dw_cell, row);
|
|
xstring itemStr = L"";
|
xstring issend = L"1";
|
itemStr += L"<RowID>" + getRowID(dw_cell, row) + L"</RowID>";
|
itemStr += L"<ItemNo>" + dw_cell.GetItemString(row, colItemNo) + L"</ItemNo>";
|
itemStr += L"<CustomerItemNo>" + dw_cell.GetItemString(row, colCustomerItemNo) + L"</CustomerItemNo>";
|
itemStr += L"<ItemName>" + dw_cell.GetItemString(row, colItemName) + L"</ItemName>";
|
itemStr += L"<ItemCName>" + dw_cell.GetItemString(row, colItemCName) + L"</ItemCName>";
|
itemStr += L"<ItemSpec>" + dw_cell.GetItemString(row, colItemSpec) + L"</ItemSpec>";
|
itemStr += L"<RowNo>" + xstring(row - startRow + 1) + L"</RowNo>";
|
itemStr += L"<Purchor>" + dw_cell.GetItemString(row, colBuyer) + L"</Purchor>";
|
itemStr += L"<Package>" + dw_cell.GetItemString(row, colPackage) + L"</Package>";
|
itemStr += L"<NWT>" + dw_cell.GetItemString(row, colNW) + L"</NWT>";
|
itemStr += L"<GWT>" + dw_cell.GetItemString(row, colGW) + L"</GWT>";
|
itemStr += L"<VolDesc>" + dw_cell.GetItemString(row, colVolDesc) + L"</VolDesc>";
|
itemStr += L"<ProductInfo>" + dw_cell.GetItemString(row, colProductInfo) + L"</ProductInfo>";
|
itemStr += L"<ProductInfo1>" + dw_cell.GetItemString(row, colProductInfo1) + L"</ProductInfo1>";
|
if (dw_cell.GetItemString(row, colBuyer) == L"")issend = L"0";
|
itemStr += L"<IsSend>" + issend + L"</IsSend>";
|
|
items += L"<Item>" + itemStr + L"</Item>";
|
}
|
items += L"</data>";
|
|
return items;
|
}
|
|
/*
|
xstring GetPurchedItems()
|
{
|
int row = 1;
|
int startRow = getItemHeadRow(dw_cell);
|
if(startRow < 1) return L"<data/>";
|
startRow++;
|
|
int colItemNo = getItemCol(dw_cell,startRow - 1,L"ÎÒ˾ÐͺÅ,ItemNo");
|
int colCustomerItemNo = getItemCol(dw_cell,startRow - 1,L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(dw_cell,startRow - 1,L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(dw_cell,startRow - 1,L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(dw_cell,startRow - 1,L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colBuyer = getItemCol(dw_cell,startRow - 1,L"²É¹ºÈËÔ±");
|
int colPackage = getItemCol(dw_cell,startRow - 1,L"Package,°ü×°·½Ê½");
|
int col40HQ= getItemCol(dw_cell,startRow - 1,L"40HQ,QTY(40HQ)");
|
int colBuyer = getItemCol(dw_cell,startRow - 1,L"²É¹ºÈËÔ±");
|
|
xstring items=L"<data>";
|
int LastRow = dw_cell.GetValidRow();
|
xstring content = L"";
|
|
for(row = startRow; row <=LastRow; row++)
|
{
|
if(dw_cell.GetItemString(row,colItemName)==L"" &&
|
dw_cell.GetItemString(row,colItemSpec)==L"") break;
|
ensureRowID(dw_cell,row);
|
|
xstring itemStr = L"";
|
xstring issend=L"1";
|
itemStr += L"<RowID>"+getRowID(dw_cell,row)+L"</RowID>";
|
itemStr += L"<ItemNo>"+dw_cell.GetItemString(row, colItemNo)+L"</ItemNo>";
|
itemStr += L"<ItemName>"+dw_cell.GetItemString(row, colItemName)+L"</ItemName>";
|
itemStr += L"<ItemCName>"+dw_cell.GetItemString(row, colItemCName)+L"</ItemCName>";
|
itemStr += L"<ItemSpec>"+dw_cell.GetItemString(row, colItemSpec)+L"</ItemSpec>";
|
itemStr += L"<RowNo>"+(row - startRow +1).toString()+L"</RowNo>";
|
itemStr += L"<Purchor>"+dw_cell.GetItemString(row, colBuyer)+L"</Purchor>";
|
itemStr += L"<Package>"+dw_cell.GetItemString(row, colPackage)+L"</Package>";
|
if(dw_cell.GetItemString(row, colBuyer) ==L"")issend=L"0";
|
itemStr += L"<IsSend>"+issend+L"</IsSend>";
|
|
items += L"<Item>"+itemStr+L"</Item>";
|
}
|
items += L"</data>";
|
|
return items;
|
}
|
*/
|
|
int OnSaleBack()
|
{
|
xstring str;
|
xstring head;
|
int rowCount = dw_cell.GetRowCount();
|
int row = 1;
|
int headrow = 0;
|
for (row = 1; row <= rowCount; row++)
|
{
|
head = dw_cell.GetItemString(row, 1);
|
if (head == L"SKUID") break;
|
}
|
|
if (row >= rowCount)
|
{
|
alert(L"ÕÒ²»µ½ÉÌÆ·ÐÐ!");
|
return 1;
|
}
|
|
headrow = row;
|
int startRow = headrow + 1;
|
int colItemNo = getItemCol(dw_cell, startRow - 1, L"ÎÒ˾ÐͺÅ,ItemNo");
|
int colCustomerItemNo = getItemCol(dw_cell, startRow - 1, L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(dw_cell, startRow - 1, L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(dw_cell, startRow - 1, L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(dw_cell, startRow - 1, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colBuyerPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û,²É¹º¼Û¸ñ");
|
int colPurchor = getItemCol(dw_cell, startRow - 1, L"²É¹ºÔ±,²É¹ºÈËÔ±");
|
|
int colBuyerMOQ = getItemCol(dw_cell, startRow - 1, L"MOQ");
|
int colBuyerRemark = getItemCol(dw_cell, startRow - 1, L"²É¹ºToÒµÎñ±¸×¢");
|
int colFactoryImage = getItemCol(dw_cell, startRow - 1, L"¹¤³§Í¼Æ¬");
|
int colGWT = getItemCol(dw_cell, startRow - 1, L"Ã«ÖØ,Ã«ÖØ(KG)");
|
int colNWT = getItemCol(dw_cell, startRow - 1, L"¾»ÖØ,¾»ÖØ(KG)");
|
int colVolDesc = getItemCol(dw_cell, startRow - 1, L"Ìå»ýÃèÊö,³¤X¿íX¸ß,³¤X¿íX¸ß(CM)");
|
int colVol = getItemCol(dw_cell, startRow - 1, L"Ìå»ý,Ìå»ý(M3)");
|
int col40HQ = getItemCol(dw_cell, startRow - 1, L"40HQ,QTY(40HQ)");
|
|
int colSupplier1 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ1");
|
int colPOPrice1 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ1");
|
int colSupplier = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ");
|
int colPOPrice = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ");
|
int colSupplier2 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ2");
|
int colPOPrice2 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ2");
|
int colSupplier3 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ3");
|
int colPOPrice3 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ3");
|
|
int colSalebackDate = getItemCol(dw_cell, startRow - 1, L"²É¹ºÌá½»ÒµÎñʱ¼ä");
|
int colProductInfo = getItemCol(dw_cell, startRow - 1, L"ÒµÎñ²¿²úÆ·ÐÅÏ¢");
|
int colProductInfo1 = getItemCol(dw_cell, startRow - 1, L"²É¹º²¿²úÆ·ÐÅÏ¢");
|
|
int LastRow = dw_cell.GetValidRow();
|
int count = 0;
|
|
int backedcount = 0;
|
for (row = startRow; row <= LastRow; row++)
|
{
|
if (getRowID(dw_cell, row) == L"") continue;
|
if (dw_cell.GetItemString(row, colItemName) == L"")continue;
|
|
if (dw_cell.GetItemString(row, colSupplier) == L"" && dw_cell.GetItemString(row, colBuyerPrice) == L"") continue;
|
count++;
|
|
/*
|
if(dw_cell.GetItemString(row, colBuyerPrice)==L"")
|
{
|
alert(L"²É¹º¼Û¸ñûÓмÈë");
|
return 1;
|
}
|
if(dw_cell.GetItemString(row, colGWT)==L"")
|
{
|
alert(L"Ã«ÖØÃ»ÓмÈë");
|
return 1;
|
}
|
if(dw_cell.GetItemString(row, colNWT)==L"")
|
{
|
alert(L"¾»ÖØÃ»ÓмÈë");
|
return 1;
|
}
|
if(dw_cell.GetItemString(row, colVolDesc)==L"")
|
{
|
alert(L"³¤X¿íX¸ßûÓмÈë");
|
return 1;
|
}
|
if(dw_cell.GetItemString(row, colFactoryImage)==L"")
|
{
|
alert(L"¹¤³§Í¼Æ¬Ã»ÓмÈë");
|
return 1;
|
}
|
if(dw_cell.GetItemString(row, colSupplier)==L"")
|
{
|
alert(L"¹©Ó¦ÉÌûÓмÈë");
|
return 1;
|
}
|
if(dw_cell.GetItemString(row, colPOPrice)==L"")
|
{
|
alert(L"²É¹º¼Û¸ñûÓмÈë");
|
return 1;
|
}*/
|
|
/*
|
if(dw_cell.GetItemString(row, colPOPrice1)!=L"")
|
{
|
if(dw_cell.GetItemString(row, colSupplier1)==L"")
|
{
|
alert(L"¹©Ó¦ÉÌ1ûÓмÈë");
|
return 1;
|
}
|
}
|
if(dw_cell.GetItemString(row, colSupplier1)!=L"")
|
{
|
if(dw_cell.GetItemString(row, colPOPrice1)==L"")
|
{
|
alert(L"²É¹º¼Û¸ñ1ûÓмÈë");
|
return 1;
|
}
|
}*/
|
}
|
if (count < 1) return 1;
|
|
int col = 0;
|
int namecol = 0;
|
int pricecol = 0;
|
int purchremarkcol = 0;
|
int purchercol = 0;
|
|
int colCount = dw_cell.GetValidCol(row);
|
for (col = 1; col <= colCount; col++)
|
{
|
head = dw_cell.GetItemString(row, col);
|
if (head == L"Product Name" || head == L"Product Description") namecol = col;
|
if (head == L"FOB Price" || head == L"Fob Price" || head == L"FOB Price(USD)") pricecol = col;
|
if (head == L"²É¹ºToÒµÎñ±¸×¢") purchremarkcol = col;
|
if (head == L"²É¹ºÈËÔ±") purchercol = col;
|
}
|
|
xstring items = GetPurchedItems();
|
xaserverarg arg4 ;
|
|
trace(items);
|
arg4.AddArg(L"value", items);
|
OpenWindow(L"dev:xpage[QuoteFilePurched.vx]", arg4);
|
|
if (arg4.GetArgString(L"process") != L"ok") return 1;
|
items = arg4.GetArgString(L"value");
|
|
xml x0 ;
|
x0.loadXML(items);
|
|
KXMLDOMNodeList ts = x0.selectNodes(L"data/Item[IsSend='1']");
|
int len = ts.length();
|
if (len < 1) return 0;
|
|
xstring content = L"";
|
xstring sdate = publiccode::GetCurrentDate();
|
for (int k = 0; k < len; k++)
|
{
|
KXMLDOMNode node = ts.item(k);
|
xstring id = node.selectSingleNode(L"RowID").text();
|
row = LookupCellRow(id);
|
if (row < 1) continue;
|
|
if (dw_cell.GetItemString(row, colBuyerPrice) == L"")
|
{
|
alert(L"²É¹º¼Û¸ñûÓмÈë");
|
return 1;
|
}
|
if (dw_cell.GetItemString(row, colGWT) == L"")
|
{
|
alert(L"Ã«ÖØÃ»ÓмÈë");
|
return 1;
|
}
|
if (dw_cell.GetItemString(row, colNWT) == L"")
|
{
|
alert(L"¾»ÖØÃ»ÓмÈë");
|
return 1;
|
}
|
if (dw_cell.GetItemString(row, colVolDesc) == L"")
|
{
|
alert(L"³¤X¿íX¸ßûÓмÈë");
|
return 1;
|
}
|
if (dw_cell.GetItemString(row, colFactoryImage) == L"")
|
{
|
alert(L"¹¤³§Í¼Æ¬Ã»ÓмÈë");
|
return 1;
|
}
|
if (dw_cell.GetItemString(row, colSupplier) == L"")
|
{
|
alert(L"¹©Ó¦ÉÌûÓмÈë");
|
return 1;
|
}
|
if (dw_cell.GetItemString(row, colPOPrice) == L"")
|
{
|
alert(L"²É¹º¼Û¸ñûÓмÈë");
|
return 1;
|
}
|
|
//if(getRowID(dw_cell,row)==L"") continue;
|
//if(dw_cell.GetItemString(row, colItemName)==L"")continue;
|
xstring itemStr = L"";
|
itemStr += L"<RowID>" + getRowID(dw_cell, row) + L"</RowID>";
|
itemStr += L"<ItemNo>" + dw_cell.GetItemString(row, colItemNo) + L"</ItemNo>";
|
itemStr += L"<ItemName>" + dw_cell.GetItemString(row, colItemName) + L"</ItemName>";
|
itemStr += L"<ItemCName>" + dw_cell.GetItemString(row, colItemCName) + L"</ItemCName>";
|
itemStr += L"<ItemSpec>" + dw_cell.GetItemString(row, colItemSpec) + L"</ItemSpec>";
|
itemStr += L"<BuyerPrice>" + dw_cell.GetItemString(row, colBuyerPrice) + L"</BuyerPrice>";
|
itemStr += L"<ProductInfo>" + dw_cell.GetItemString(row, colProductInfo) + L"</ProductInfo>";
|
itemStr += L"<ProductInfo1>" + dw_cell.GetItemString(row, colProductInfo1) + L"</ProductInfo1>";
|
itemStr += L"<Buyer>" + dw_cell.GetItemString(row, colPurchor) + L"</Buyer>";
|
|
/*
|
if(dw_cell.GetItemString(row, colBuyerPrice)==L"") return L"²É¹º¼Û¸ñûÓмÈë";
|
if(dw_cell.GetItemString(row, colGWT)==L"") return L"Ã«ÖØÃ»ÓмÈë";
|
if(dw_cell.GetItemString(row, colNWT)==L"") return L"¾»ÖØÃ»ÓмÈë";
|
if(dw_cell.GetItemString(row, colVolDesc)==L"") return L"³¤X¿íX¸ßûÓмÈë";
|
if(dw_cell.GetItemString(row, colFactoryImage)==L"") return L"ͼƬûÓмÈë";
|
|
if(dw_cell.GetItemString(row, colSupplier)==L"") return L"¹©Ó¦ÉÌûÓмÈë";
|
if(dw_cell.GetItemString(row, colPOPrice)==L"") return L"²É¹º¼Û¸ñûÓмÈë";
|
|
if(dw_cell.GetItemString(row, colPOPrice1)!=L"")
|
{
|
if(dw_cell.GetItemString(row, colSupplier1)==L"") return L"¹©Ó¦ÉÌ1ûÓмÈë";
|
}
|
if(dw_cell.GetItemString(row, colSupplier1)!=L"")
|
{
|
if(dw_cell.GetItemString(row, colPOPrice1)==L"") return L"²É¹º¼Û¸ñ1ûÓмÈë";
|
}
|
if(dw_cell.GetItemString(row, colGWT)!=L"")
|
{
|
if(dw_cell.GetItemString(row, colGWT)==L"") return L"Ã«ÖØÃ»ÓмÈë";
|
}
|
if(dw_cell.GetItemString(row, colNWT)!=L"")
|
{
|
if(dw_cell.GetItemString(row, colNWT)==L"") return L"¾»ÖØÃ»ÓмÈë";
|
}
|
if(dw_cell.GetItemString(row, colVolDesc)!=L"")
|
{
|
if(dw_cell.GetItemString(row, colVolDesc)==L"") return L"Ìå»ýÐÅϢûÓмÈë";
|
}
|
*/
|
itemStr += L"<BuyerMOQ>" + dw_cell.GetItemString(row, colBuyerMOQ) + L"</BuyerMOQ>";
|
itemStr += L"<BuyerRemark>" + dw_cell.GetItemString(row, colBuyerRemark) + L"</BuyerRemark>";
|
itemStr += L"<FactoryImage>" + dw_cell.GetItemString(row, colFactoryImage) + L"</FactoryImage>";
|
itemStr += L"<GWT>" + dw_cell.GetItemString(row, colGWT) + L"</GWT>";
|
itemStr += L"<NWT>" + dw_cell.GetItemString(row, colNWT) + L"</NWT>";
|
itemStr += L"<VolDesc>" + dw_cell.GetItemString(row, colVolDesc) + L"</VolDesc>";
|
itemStr += L"<Vol>" + dw_cell.GetItemString(row, colVol) + L"</Vol>";
|
itemStr += L"<F40HQ>" + dw_cell.GetItemString(row, col40HQ) + L"</F40HQ>";
|
|
itemStr += L"<PurchedDate>" + sdate + L"</PurchedDate>";
|
itemStr += L"<supplier-photo>" + getRowTerm(dw_cell, row, L"supplier-photo") + L"</supplier-photo>";
|
|
xstring eid = GetGuid();
|
setRowTerm(dw_cell, row, L"EnquiryLineID", eid);
|
//alert(eid +L" "+ getRowTerm(dw_cell,row,L"EnquiryLineID"));
|
itemStr += L"<EnquiryLineID>" + eid + L"</EnquiryLineID>";
|
content += L"<Item>" + itemStr + L"</Item>";
|
|
dw_cell.SetItemString(row, colSalebackDate, sdate);
|
}
|
|
xstring finished = L"1";
|
for (row = startRow; row <= LastRow; row++)
|
{
|
if (getRowID(dw_cell, row) == L"") continue;
|
if (dw_cell.GetItemString(row, colItemName) == L"")continue;
|
if (dw_cell.GetItemString(row, colSalebackDate) == L"")
|
{
|
finished = L"0";
|
break;
|
}
|
}
|
|
//trace(L"\r\n******11"+sdate);
|
xstring newEntityItemID = ViewObject::GetGuid();
|
xstring datacontent = GetSaleFullData(dw_cell, ts);
|
|
content = L"<data id='" + entityID + L"' itemid='" + newEntityItemID + L"' itemid.piror='" + entityItemID + L"' action='purched' taskid='" + taskid + L"' finished='" + finished + L"'>" + content + L"</data>";
|
xstring myurl = L"/task/quote/purchar/backtosaler";
|
if (content != L"")
|
{
|
trace(L"\r\ntaskid:" + taskid + L" finished:" + finished);
|
ProcessSendMessage(myurl, L"", content, datacontent, true);
|
PostMessage(GetFrameWindow().GetHWND(), 0x401, (WPARAM)L"xmRefreshTask", 0);
|
}
|
|
return 1;
|
}
|
|
int OnPurchEx()
|
{
|
xstring str;
|
xstring head;
|
int rowCount = dw_cell.GetRowCount();
|
int row = 1;
|
int headrow = 0;
|
for (row = 1; row <= rowCount; row++)
|
{
|
head = dw_cell.GetItemString(row, 1);
|
if (head == L"SKUID") break;
|
}
|
|
if (row >= rowCount)
|
{
|
alert(L"ÕÒ²»µ½ÉÌÆ·ÐÐ!");
|
return 1;
|
}
|
|
headrow = row;
|
int startRow = headrow + 1;
|
int colCustomerItemNo = getItemCol(dw_cell, headrow, L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(dw_cell, headrow, L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(dw_cell, headrow, L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(dw_cell, headrow, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colItemQty = getItemCol(dw_cell, headrow, L"ÊýÁ¿,Qty");
|
//int colItemSpec = getItemCol(dw_cell,headrow,L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colItemPurchDate = getItemCol(dw_cell, headrow, L"ÒµÎñ·¢ËͲɹºÊ±¼ä");
|
int col40HQ = getItemCol(dw_cell, startRow - 1, L"40HQ,QTY(40HQ)");
|
int colInnerOuter = getItemCol(dw_cell, startRow - 1, L"×°ÏäÊý(ÄÚ/Íâ)");
|
int col = 0;
|
int namecol = 0;
|
int pricecol = 0;
|
int purchremarkcol = 0;
|
int purchercol = 0;
|
|
int colCount = dw_cell.GetValidCol(row);
|
for (col = 1; col <= colCount; col++)
|
{
|
head = dw_cell.GetItemString(row, col);
|
if (head == L"Product Name" || head == L"Product Description") namecol = col;
|
if (head == L"FOB Price" || head == L"Fob Price" || head == L"FOB Price(USD)") pricecol = col;
|
if (head == L"²É¹ºToÒµÎñ±¸×¢") purchremarkcol = col;
|
if (head == L"²É¹ºÈËÔ±") purchercol = col;
|
}
|
|
if (purchercol == 0)
|
{
|
alert(L"ÕÒ²»µ½²É¹ºÈËÔ±Êý¾Ý!");
|
return 1;
|
}
|
|
xstring items = GetPurchItems();
|
xaserverarg arg4 ;
|
|
trace(items);
|
arg4.AddArg(L"value", items);
|
OpenWindow(L"dev:xpage[QuoteFilePurch.vx]", arg4);
|
if (arg4.GetArgString(L"process") != L"ok") return 1;
|
items = arg4.GetArgString(L"value");
|
|
return 1;
|
}
|
|
int OnNextPurch()
|
{
|
//dw_cell.AcceptText();
|
|
xstring str;
|
xstring head;
|
int rowCount = dw_cell.GetValidRow();
|
int row = 1;
|
int headrow = 0;
|
for (row = 1; row <= rowCount; row++)
|
{
|
head = dw_cell.GetItemString(row, 1);
|
if (head == L"SKUID") break;
|
}
|
|
if (row >= rowCount)
|
{
|
alert(L"ÕÒ²»µ½ÉÌÆ·ÐÐ!");
|
return 1;
|
}
|
|
headrow = row;
|
int startRow = headrow + 1;
|
int colCustomerItemNo = getItemCol(dw_cell, headrow, L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(dw_cell, headrow, L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(dw_cell, headrow, L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(dw_cell, headrow, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colItemQty = getItemCol(dw_cell, headrow, L"ÊýÁ¿,Qty");
|
//int colItemSpec = getItemCol(dw_cell,headrow,L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colItemPurchDate = getItemCol(dw_cell, headrow, L"ÒµÎñ·¢ËͲɹºÊ±¼ä");
|
int col40HQ = getItemCol(dw_cell, startRow - 1, L"40HQ,QTY(40HQ)");
|
int colInnerOuter = getItemCol(dw_cell, startRow - 1, L"×°ÏäÊý(ÄÚ/Íâ)");
|
int colSalebackDate = getItemCol(dw_cell, startRow - 1, L"²É¹ºÌá½»ÒµÎñʱ¼ä");
|
|
int col = 0;
|
int namecol = 0;
|
int pricecol = 0;
|
int purchremarkcol = 0;
|
int purchercol = 0;
|
|
int colCount = dw_cell.GetValidCol(row);
|
for (col = 1; col <= colCount; col++)
|
{
|
head = dw_cell.GetItemString(row, col);
|
if (head == L"Product Name" || head == L"Product Description") namecol = col;
|
if (head == L"FOB Price" || head == L"Fob Price" || head == L"FOB Price(USD)") pricecol = col;
|
if (head == L"²É¹ºToÒµÎñ±¸×¢") purchremarkcol = col;
|
if (head == L"²É¹ºÈËÔ±") purchercol = col;
|
}
|
if (purchercol == 0)
|
{
|
alert(L"ÕÒ²»µ½²É¹ºÈËÔ±Êý¾Ý!");
|
return 1;
|
}
|
|
xstring strs = L",";
|
row++;
|
|
int colCustomerPhoto = getItemCol(dw_cell, startRow - 1, L"Photo,Customer Photo");
|
int colPackage = getItemCol(dw_cell, startRow - 1, L"Package,°ü×°·½Ê½");
|
|
while (row <= rowCount)
|
{
|
str = dw_cell.GetItemString(row, purchercol);
|
if (str == L"")break;
|
|
//ensureRowID(dw_cell,row);
|
if (strs.find(L"," + str + L",") < 0)
|
{
|
if (purcher.selectSingleNode(L"//Name[.='" + str + L"']"))
|
{
|
strs += str + L",";
|
}
|
else
|
{
|
alert(L"ûÓвɹºÔ±£º" + str);
|
return 1;
|
}
|
}
|
row++;
|
}
|
if (strs == L",")
|
{
|
alert(L"ÇëÖ¸¶¨²É¹ºÈËÔ±!");
|
return 1;
|
}
|
|
xstring items = GetPurchItems();
|
xaserverarg arg4 ;
|
arg4.AddArg(L"value", items);
|
OpenWindow(L"dev:xpage[QuoteFilePurch.vx]", arg4);
|
if (arg4.GetArgString(L"process") != L"ok") return 1;
|
items = arg4.GetArgString(L"value");
|
|
xml x0 ;
|
x0.loadXML(items);
|
KXMLDOMNodeList ts1 = x0.selectNodes(L"data/Item");
|
int len1 = ts1.length();
|
for (int m = 0; m < len1; m++)
|
{
|
KXMLDOMNode node = ts1.item(m);
|
xstring rowno = L"";
|
xstring purchar = L"";
|
if (node.selectSingleNode(L"RowNo")) rowno = node.selectSingleNode(L"RowNo").text();
|
if (node.selectSingleNode(L"Purchor")) purchar = node.selectSingleNode(L"Purchor").text();
|
//alert( rowno+L" "+ node.xml);
|
if (rowno != L"")
|
{
|
int row1 = headrow + rowno.toInt();
|
if (dw_cell.GetItemString(row1, purchercol) != purchar)
|
{
|
dw_cell.SetItemString(row1, purchercol, purchar);
|
}
|
}
|
}
|
|
row = headrow + 1;
|
strs = L"";
|
while (row <= rowCount)
|
{
|
str = dw_cell.GetItemString(row, purchercol);
|
if (str == L"")break;
|
|
if (strs.find(L"," + str + L",") < 0)
|
{
|
if (purcher.selectSingleNode(L"//Name[.='" + str + L"']"))
|
{
|
strs += str + L",";
|
}
|
else
|
{
|
alert(L"ûÓвɹºÔ±£º" + str);
|
return 1;
|
}
|
}
|
row++;
|
}
|
//return 1;
|
|
xstring cellstr = dw_cell.GetData();
|
xcell cell1 = GetControl(L"dw_cell1");
|
xml x ;
|
|
|
if (strs.left(1) == L",") strs = strs.mid(1, 9999);
|
if (strs.right(1) == L",") strs = strs.left(strs.length() - 1);
|
|
xstring purchors = strs;
|
|
xstring supplier;
|
if (strs.find(L",", 0) > 0)
|
{
|
supplier = strs.left(strs.find(L",", 0));
|
strs = strs.mid(strs.find(L",", 0) + 1, 9999);
|
}
|
else
|
{
|
supplier = strs;
|
strs = L"";
|
}
|
|
xstring username = publiccode::GetUser().name;
|
|
while (supplier != L"")
|
{
|
KXMLDOMNodeList ts = x0.selectNodes(L"data/Item[IsSend='1' and Purchor='" + supplier + L"']");
|
int len = ts.length();
|
if (supplier == username) len = 0;
|
if (len < 1)
|
{
|
if (strs.find(L",", 0) > 0)
|
{
|
supplier = strs.left(strs.find(L",", 0));
|
strs = strs.mid(strs.find(L",", 0) + 1, 9999);
|
}
|
else
|
{
|
supplier = strs;
|
strs = L"";
|
}
|
continue;
|
}
|
x.loadXML(cellstr);
|
cell1.LoadTemplate(x);
|
cell1.Redraw();
|
|
row = headrow + 1;
|
int cnt = 1;
|
while (true)
|
{
|
str = L"";
|
str = cell1.GetItemString(row, purchercol);
|
if (str == L"")break;
|
if (str != supplier)
|
{
|
cell1.SetRowColumn(row, 1);
|
cell1.SetAnchorRowColumn(row, 1);
|
SendCtrlCmd(cell1, L"xmFormatCellDeleteRow");
|
}
|
else
|
{
|
KXMLDOMNode n = x0.selectSingleNode(L"data/Item[IsSend='1' and Purchor='" + supplier + L"' and RowNo='" + xstring(cnt) + L"']");
|
if (!n)
|
{
|
cell1.SetRowColumn(row, 1);
|
cell1.SetAnchorRowColumn(row, 1);
|
SendCtrlCmd(cell1, L"xmFormatCellDeleteRow");
|
}
|
else
|
{
|
row = row + 1;
|
}
|
}
|
cnt++;
|
if (cnt > 512)break;
|
}
|
|
cell1.SetRowColumn(1, 1);
|
cell1.SetAnchorRowColumn(1, 1);
|
|
row = headrow + 1;
|
rowCount = cell1.GetValidRow();
|
|
|
if (SendToPurcher(supplier, cell1.GetData()) == -1) return 1;
|
if (strs.find(L",", 0) > 0)
|
{
|
supplier = strs.left(strs.find(L",", 0));
|
strs = strs.mid(strs.find(L",", 0) + 1, 9999);
|
}
|
else
|
{
|
supplier = strs;
|
strs = L"";
|
}
|
}
|
|
int purchercol1 = 0;
|
//update purch
|
if (1 == 0)
|
{
|
//trace(L"\r\nentityID:"+entityID);
|
xml x2 = ViewObject::RetrieveData(L"/sale/data/TO/business/documententity", L"BusinessID", entityID);
|
if (x2)
|
{
|
//trace(x2.GetXml());
|
cell1.LoadTemplate(x2);
|
cell1.Redraw();
|
}
|
else
|
{
|
alert(L"³öÏÖ´íÎó");
|
return 1;
|
}
|
|
xstring head1;
|
int rowCount1 = cell1.GetValidRow();
|
int row2 = 1;
|
int headrow1 = 0;
|
int startrow1 = 0;
|
for (row2 = 1; row2 <= rowCount1; row2++)
|
{
|
head1 = cell1.GetItemString(row2, 1);
|
if (head1 == L"SKUID") break;
|
}
|
|
headrow1 = row2;
|
startrow1 = headrow1 + 1;
|
purchercol1 = getItemCol(cell1, headrow1, L"²É¹ºÈËÔ±");
|
}
|
|
|
//Clear
|
if (1 == 1)
|
{
|
row = headrow + 1;
|
strs = L"";
|
while (row <= rowCount)
|
{
|
str = dw_cell.GetItemString(row, purchercol);
|
if (str == L"")break;
|
row++;
|
}
|
int lastrow = row - 1;
|
row = headrow + 1;
|
int drow = 0;
|
while (lastrow >= row)
|
{
|
supplier = L"";
|
supplier = dw_cell.GetItemString(lastrow, purchercol);
|
if (supplier != username)
|
{
|
KXMLDOMNode n1 = x0.selectSingleNode(L"data/Item[IsSend='1' and Purchor='" + supplier + L"' and RowNo='" + xstring(lastrow - row + 1) + L"']");
|
if (n1)
|
{
|
xstring rowid = getRowID(dw_cell, lastrow);
|
int frow = LookupCellRow(rowid);
|
if (0 == 1)
|
{
|
if (drow > 0)cell1.SetItemString(frow, purchercol1, supplier);
|
}
|
dw_cell.SetRowColumn(lastrow, 1);
|
dw_cell.SetAnchorRowColumn(lastrow, 1);
|
SendCtrlCmd(dw_cell, L"xmFormatCellDeleteRow");
|
drow++;
|
}
|
}
|
lastrow--;
|
}
|
}
|
|
xstring finished = L"1";
|
for (row = startRow; row <= rowCount; row++)
|
{
|
if (getRowID(dw_cell, row) == L"") continue;
|
if (dw_cell.GetItemString(row, colItemName) == L"")continue;
|
if (dw_cell.GetItemString(row, colSalebackDate) == L"")
|
{
|
finished = L"0";
|
break;
|
}
|
}
|
|
if (0 == 1)OnUpdateEntityFile();
|
OnUpdate();
|
|
if (finished == L"1")
|
{
|
OnUpdateProcessed();
|
alert(L"xxxxx");
|
}
|
|
//OnSaveEx(true);
|
//alert(L"ѯ¼ÛÐÅÏ¢ÒÑ·¢Ë͸ø:"+purchors);
|
return 1;
|
}
|
|
int OnPurch()
|
{
|
xstring str;
|
xstring head;
|
int rowCount = dw_cell.GetRowCount();
|
int row = 1;
|
int headrow = 0;
|
for (row = 1; row <= rowCount; row++)
|
{
|
head = dw_cell.GetItemString(row, 1);
|
if (head == L"SKUID") break;
|
}
|
|
if (dw_base.GetItemString(1, L"CustomerID") == L"")
|
{
|
alert(L"ÇëÊäÈ뱨¼ÛµÄ¿Í»§!");
|
return 1;
|
}
|
|
if (row >= rowCount)
|
{
|
alert(L"ÕÒ²»µ½ÉÌÆ·ÐÐ!");
|
return 1;
|
}
|
|
if (getBaseItem(dw_cell, L"±¨¼Û½ØÖ¹ÈÕÆÚ£º") == L"")
|
{
|
if (getBaseItem(dw_cell, L"±¨¼Û½ØÖ¹ÈÕÆÚ:") == L"")
|
{
|
alert(L"±¨¼Û½ØÖ¹ÈÕÆÚδÊäÈë!");
|
return 1;
|
}
|
}
|
|
if (getBaseItem(dw_cell, L"ÏîÄ¿Ãû³Æ:") == L"")
|
{
|
if (getBaseItem(dw_cell, L"ÏîÄ¿Ãû³Æ£º") == L"")
|
{
|
alert(L"ÏîÄ¿Ãû³ÆÎ´ÊäÈë!");
|
return 1;
|
}
|
}
|
|
headrow = row;
|
int startRow = headrow + 1;
|
int colCustomerItemNo = getItemCol(dw_cell, headrow, L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(dw_cell, headrow, L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(dw_cell, headrow, L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(dw_cell, headrow, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colItemQty = getItemCol(dw_cell, headrow, L"ÊýÁ¿,Qty");
|
//int colItemSpec = getItemCol(dw_cell,headrow,L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colItemPurchDate = getItemCol(dw_cell, headrow, L"ÒµÎñ·¢ËͲɹºÊ±¼ä");
|
int col40HQ = getItemCol(dw_cell, startRow - 1, L"40HQ,QTY(40HQ)");
|
int colInnerOuter = getItemCol(dw_cell, startRow - 1, L"×°ÏäÊý(ÄÚ/Íâ)");
|
|
int col = 0;
|
int namecol = 0;
|
int pricecol = 0;
|
int purchremarkcol = 0;
|
int purchercol = 0;
|
|
int colCount = dw_cell.GetValidCol(row);
|
for (col = 1; col <= colCount; col++)
|
{
|
head = dw_cell.GetItemString(row, col);
|
if (head == L"Product Name" || head == L"Product Description") namecol = col;
|
if (head == L"FOB Price" || head == L"Fob Price" || head == L"FOB Price(USD)") pricecol = col;
|
if (head == L"²É¹ºToÒµÎñ±¸×¢") purchremarkcol = col;
|
if (head == L"²É¹ºÈËÔ±") purchercol = col;
|
}
|
if (purchercol == 0)
|
{
|
alert(L"ÕÒ²»µ½²É¹ºÈËÔ±Êý¾Ý!");
|
return 1;
|
}
|
|
xstring strs = L",";
|
row++;
|
|
int colCustomerPhoto = getItemCol(dw_cell, startRow - 1, L"Photo,Customer Photo");
|
int colPackage = getItemCol(dw_cell, startRow - 1, L"Package,°ü×°·½Ê½");
|
|
while (row <= rowCount)
|
{
|
str = dw_cell.GetItemString(row, purchercol);
|
if (str == L"")break;
|
|
/*if(dw_cell.GetItemString(row,colCustomerItemNo)==L"")
|
{
|
alert(L"µÚ"+xstring(row)+L"ÐÐÇëÊäÈë¿Í»§ÐͺÅ!");
|
return 1;
|
}*/
|
if (dw_cell.GetItemString(row, colItemName) == L"" || dw_cell.GetItemString(row, colItemCName) == L"")
|
{
|
alert(L"µÚ" + xstring(row) + L"ÐÐÇëÊäÈë²úÆ·Ãû³Æ!");
|
return 1;
|
}
|
if (dw_cell.GetItemString(row, colPackage) == L"")
|
{
|
alert(L"µÚ" + xstring(row) + L"ÐÐÇëÊäÈë²úÆ·°ü×°·½Ê½!");
|
return 1;
|
}
|
if (dw_cell.GetItemString(row, colCustomerPhoto) == L"")
|
{
|
alert(L"µÚ" + xstring(row) + L"ÐÐÇëÑ¡Ôñ¿Í»§Í¼Æ¬!");
|
return 1;
|
}
|
if (dw_cell.GetItemString(row, colInnerOuter) == L"")
|
{
|
alert(L"µÚ" + xstring(row) + L"ÐÐÇë¼ÈëÄÚÍâÏä×°Êý!");
|
return 1;
|
}
|
/*if(dw_cell.GetItemString(row,col40HQ)==L"")
|
{
|
alert(L"µÚ"+xstring(row)+L"ÐÐ40HQµÄÊý¾ÝÊǿյÄ!");
|
return 1;
|
}*/
|
|
/*if(dw_cell.GetItemString(row,colItemQty)==L"")
|
{
|
alert(L"µÚ"+xstring(row)+L"ÐÐÊýÁ¿ÊǿյÄ!");
|
return 1;
|
}*/
|
|
ensureRowID(dw_cell, row);
|
if (strs.find(L"," + str + L",") < 0)
|
{
|
if (purcher.selectSingleNode(L"//Name[.='" + str + L"']"))
|
{
|
strs += str + L",";
|
}
|
else
|
{
|
alert(L"ûÓвɹºÔ±£º" + str);
|
return 1;
|
}
|
}
|
row++;
|
}
|
if (strs == L",")
|
{
|
alert(L"ÕÒ²»µ½²É¹ºÈËÔ±Êý¾Ý!");
|
return 1;
|
}
|
|
xstring items = GetPurchItems();
|
xaserverarg arg4 ;
|
|
trace(items);
|
arg4.AddArg(L"value", items);
|
OpenWindow(L"dev:xpage[QuoteFilePurch.vx]", arg4);
|
if (arg4.GetArgString(L"process") != L"ok") return 1;
|
items = arg4.GetArgString(L"value");
|
|
xstring cellstr = dw_cell.GetData();
|
xcell cell1 = GetControl(L"dw_cell1");
|
xml x ;
|
|
|
if (strs.left(1) == L",") strs = strs.mid(1, 9999);
|
if (strs.right(1) == L",") strs = strs.left(strs.length() - 1);
|
|
xstring purchors = strs;
|
|
xstring supplier;
|
if (strs.find(L",", 0) > 0)
|
{
|
supplier = strs.left(strs.find(L",", 0));
|
strs = strs.mid(strs.find(L",", 0) + 1, 9999);
|
}
|
else
|
{
|
supplier = strs;
|
strs = L"";
|
}
|
|
xml x0 ;
|
x0.loadXML(items);
|
|
while (supplier != L"")
|
{
|
KXMLDOMNodeList ts = x0.selectNodes(L"data/Item[IsSend='1' and Purchor='" + supplier + L"']");
|
int len = ts.length();
|
if (len < 1)
|
{
|
if (strs.find(L",", 0) > 0)
|
{
|
supplier = strs.left(strs.find(L",", 0));
|
strs = strs.mid(strs.find(L",", 0) + 1, 9999);
|
}
|
else
|
{
|
supplier = strs;
|
strs = L"";
|
}
|
continue;
|
}
|
x.loadXML(cellstr);
|
cell1.LoadTemplate(x);
|
cell1.Redraw();
|
|
row = headrow + 1;
|
int cnt = 1;
|
while (true)
|
{
|
str = L"";
|
str = cell1.GetItemString(row, purchercol);
|
if (str == L"")break;
|
if (str != supplier)
|
{
|
cell1.SetRowColumn(row, 1);
|
cell1.SetAnchorRowColumn(row, 1);
|
SendCtrlCmd(cell1, L"xmFormatCellDeleteRow");
|
}
|
else
|
{
|
trace(L"\r\ndata/Item[IsSend='1' and Purchor='" + supplier + L"' and RowNo='" + xstring(cnt) + L"']");
|
KXMLDOMNode n = x0.selectSingleNode(L"data/Item[IsSend='1' and Purchor='" + supplier + L"' and RowNo='" + xstring(cnt) + L"']");
|
if (!n)
|
{
|
cell1.SetRowColumn(row, 1);
|
cell1.SetAnchorRowColumn(row, 1);
|
SendCtrlCmd(cell1, L"xmFormatCellDeleteRow");
|
}
|
else
|
{
|
if (colItemPurchDate > 0)
|
{
|
xstring sdate = publiccode::GetCurrentDate();
|
dw_cell.SetItemString(headrow + cnt, colItemPurchDate, sdate);
|
cell1.SetItemString(row, colItemPurchDate, sdate);
|
dw_cell.Redraw();
|
}
|
row = row + 1;
|
}
|
}
|
cnt++;
|
if (cnt > 512)break;
|
}
|
|
if (pricecol > 0)
|
{
|
|
cell1.SetRowColumn(1, purchercol);
|
cell1.SetAnchorRowColumn(1, purchercol);
|
SendCtrlCmd(cell1, L"xmFormatCellInsertCol");
|
cell1.SetItemString(headrow, purchercol, L"ÒµÎñÔ±");
|
|
cell1.SetRowColumn(1, pricecol);
|
cell1.SetAnchorRowColumn(1, pricecol);
|
SendCtrlCmd(cell1, L"xmFormatCellDeleteCol");
|
|
|
cell1.SetRowColumn(1, purchremarkcol + 1);
|
cell1.SetAnchorRowColumn(1, purchremarkcol + 1);
|
SendCtrlCmd(cell1, L"xmFormatCellInsertCol");
|
SendCtrlCmd(cell1, L"xmFormatCellInsertCol");
|
SendCtrlCmd(cell1, L"xmFormatCellInsertCol");
|
SendCtrlCmd(cell1, L"xmFormatCellInsertCol");
|
SendCtrlCmd(cell1, L"xmFormatCellInsertCol");
|
SendCtrlCmd(cell1, L"xmFormatCellInsertCol");
|
|
cell1.SetItemString(headrow, purchremarkcol + 1, L"¹©Ó¦ÉÌ");
|
cell1.SetItemString(headrow, purchremarkcol + 2, L"ÀàÐÍ");
|
cell1.SetItemString(headrow, purchremarkcol + 3, L"¼Û¸ñ");
|
cell1.SetItemString(headrow, purchremarkcol + 4, L"¹©Ó¦ÉÌ1");
|
cell1.SetItemString(headrow, purchremarkcol + 5, L"ÀàÐÍ1");
|
cell1.SetItemString(headrow, purchremarkcol + 6, L"¼Û¸ñ1");
|
|
int colRemark = getItemCol(cell1, headrow, L"Remarks");
|
cell1.SetRowColumn(1, colRemark);
|
cell1.SetAnchorRowColumn(1, colRemark);
|
SendCtrlCmd(cell1, L"xmFormatCellDeleteCol");
|
}
|
cell1.SetRowColumn(1, 1);
|
cell1.SetAnchorRowColumn(1, 1);
|
|
row = headrow + 1;
|
rowCount = cell1.GetValidRow();
|
while (row <= rowCount)
|
{
|
str = cell1.GetItemString(row, purchercol);
|
if (str == L"")break;
|
xstring susername = publiccode::GetUser().name;
|
cell1.SetItemString(row, purchercol - 1, susername);
|
row++;
|
}
|
|
if (SendToPurcher(supplier, cell1.GetData()) == -1) return 1;
|
if (strs.find(L",", 0) > 0)
|
{
|
supplier = strs.left(strs.find(L",", 0));
|
strs = strs.mid(strs.find(L",", 0) + 1, 9999);
|
}
|
else
|
{
|
supplier = strs;
|
strs = L"";
|
}
|
|
}
|
OnUpdate();
|
//OnSaveEx(true);
|
//alert(L"ѯ¼ÛÐÅÏ¢ÒÑ·¢Ë͸ø:"+purchors);
|
|
return 1;
|
}
|
|
//½¹µã¼¤»î´¦Àíº¯Êý
|
int OnSetFocus(TEvent* evt, LPARAM param)
|
{
|
//ÖØÖù¤¾ßÌõ
|
SetAgent();
|
return 1;
|
}
|
|
int OpenTemplate(xstring id)
|
{
|
xml x = ViewObject::RetrieveData(L"/sale/data/TO/template/param", L"TemplateID", id);
|
|
xml sheet ;
|
sheet.loadXML(x.selectSingleNode(L"data/*").xml());
|
|
dw_cell.LoadTemplate(sheet);
|
dw_cell.Redraw();
|
|
return 1;
|
}
|
|
int OpenDocument(xstring id)
|
{
|
trace(L"BusinessItemID:" + id);
|
xml x = ViewObject::RetrieveData(L"/sale/data/TO/business/document", L"BusinessItemID", id);
|
|
/*
|
xml sheet ;
|
sheet.setNativePointer(x.CreateInstance());
|
sheet.loadXML(x.selectSingleNode(L"data/*").xml);
|
wangushendi xiuluowushen taigukuangmo
|
*/
|
|
//trace(x.xml());
|
dw_cell.LoadTemplate(x);
|
dw_cell.Redraw();
|
|
return 1;
|
}
|
|
xml GetProduct(xstring GoodsNo)
|
{
|
return ViewObject::RetrieveData(L"/sale/data/ProductLibrary3/ProductByGoodsNoWithShip", L"GoodsNo", GoodsNo);
|
}
|
|
int OpenDocumentEntity(xstring id)
|
{
|
xml x = ViewObject::RetrieveData(L"/sale/data/TO/business/documententity", L"BusinessID", id);
|
|
/*
|
xml sheet ;
|
sheet.setNativePointer(x.CreateInstance());
|
sheet.loadXML(x.selectSingleNode(L"data/*").xml);
|
*/
|
|
dw_cell.LoadTemplate(x);
|
dw_cell.Redraw();
|
|
return 1;
|
}
|
|
int Reset()
|
{
|
action = L"new";
|
entityID = L"";
|
entityItemID = L"";
|
templateID = L"";
|
return 1;
|
}
|
|
xstring UploadImage(xstring guid)
|
{
|
return UploadImage(guid, L"");
|
}
|
|
xstring UploadImage(xstring guid, xstring filename)
|
{
|
xstring name = guid + L".jpg";
|
xstring str = name.mid(0, 2);
|
str = str.toUpper();
|
int ret = 1;
|
if (filename != L"")
|
ret = xaserver::Upload(L"product" + str, name, filename, GetHWND(), L"", false);
|
else
|
ret = xaserver::Upload(L"product" + str, name.c_str(), GetHWND(), L"", false);
|
if (ret == -1) return L"";
|
if (ret == 0)
|
{
|
alert(L"ͼƬÉÏ´«Ê§°Ü£¡");
|
return L"";
|
}
|
return GetImageUrl(guid);
|
|
/*
|
xstring appPath = GetModuleTmpPath();
|
xaserver::CreateDirectory(appPath);
|
ret = xaserver::DownLoadFile(GetServerUrl(),L"/business/products/chanpin/"+str+L"/"+name,name,appPath+L"/"+name);
|
if(ret < 0)
|
{
|
alert(L"ͼƬÏÂÔØÊ§°Ü1£¡");
|
return L"";
|
}
|
|
xutil::SmallImage(appPath+L"\\"+name,appPath+L"\\"+L"x_"+name,120,120);
|
int ret_1 = xaserver::Upload(L"product"+str, L"x_"+name,appPath+L"\\x_"+name, GetHWND(),L"",false);
|
//xaserver::DeleteFile(appPath+L"x_"+name);
|
//xaserver::DeleteFile(appPath+name);
|
if(ret_1 != 1)
|
{
|
alert(L"ÉÏ´«ËõÂÔͼʧ°Ü!");
|
return L"";
|
}
|
return appPath+L"/"+name;
|
*/
|
}
|
|
xstring UploadImage1(xstring guid, xstring filename)
|
{
|
xstring name = guid + L".jpg";
|
xstring str = name.mid(0, 2);
|
str = str.toUpper();
|
int ret = 1;
|
if (filename != L"")
|
ret = xaserver::Upload(L"product" + str, name, filename, GetHWND(), L"", false);
|
else
|
ret = xaserver::Upload(L"product" + str, name, GetHWND(), L"", false);
|
if (ret == -1) return L"";
|
if (ret == 0)
|
{
|
alert(L"ͼƬÉÏ´«Ê§°Ü£¡");
|
return L"";
|
}
|
|
xstring appPath = xutil::GetModuleTmpPath();
|
xaserver::CreateDirectory(appPath);
|
ret = xaserver::DownLoadFile(GetServerUrl(), L"/business/products/chanpin/" + str + L"/" + name, name, appPath + L"/" + name);
|
if (ret < 0)
|
{
|
alert(L"ͼƬÏÂÔØÊ§°Ü1£¡");
|
return L"";
|
}
|
|
xutil::SmallImage(appPath + L"\\" + name, appPath + L"\\" + L"x_" + name, 120, 120);
|
int ret_1 = xaserver::Upload(L"product" + str, L"x_" + name, appPath + L"\\x_" + name, GetHWND(), L"", false);
|
//xaserver::DeleteFile(appPath+L"x_"+name);
|
//xaserver::DeleteFile(appPath+name);
|
if (ret_1 != 1)
|
{
|
alert(L"ÉÏ´«ËõÂÔͼʧ°Ü!");
|
return L"";
|
}
|
return appPath + L"/" + name;
|
}
|
|
int ClearImageTerm(int row, xstring tm)
|
{
|
xstring str = dw_cell.GetItemString(row, 0);
|
if (str.right(1) != L";") str += L";";
|
if (str.find(tm + L":") >= 0)
|
{
|
int pos = str.find(L";", str.find(tm + L":") + 1);
|
if (pos < 0) return 1;
|
str = str.left(str.find(tm + L":")) + str.mid(pos, 99999);
|
}
|
return 1;
|
}
|
|
int AddImageTermEx(int row, xstring tm, xstring guid, xstring path = L"")
|
{
|
ximageview im = GetControl(L"frame:im1");
|
xstring str = dw_cell.GetItemString(row, 0);
|
if (str.right(1) != L";") str += L";";
|
if (str.find(tm + L":") >= 0)
|
{
|
int pos = str.find(L";", str.find(tm + L":") + 1);
|
if (pos < 0) return 1;
|
str = str.left(pos) + L"," + guid + str.mid(pos, 99999);
|
}
|
else
|
{
|
str += tm + L":" + guid + L";";
|
}
|
dw_cell.SetItemString(row, 0, str);
|
return 1;
|
}
|
|
int AddImageTerm(int row, xstring tm, xstring guid, xstring path = L"")
|
{
|
ximageview im = GetControl(L"frame:im1");
|
xstring str = dw_cell.GetItemString(row, 0);
|
if (str.right(1) != L";") str += L";";
|
if (str.find(tm + L":") >= 0)
|
{
|
int pos = str.find(L";", str.find(tm + L":") + 1);
|
if (pos < 0) return 1;
|
if (pos > 0 && str.mid(pos - 1, 1) == L":")
|
str = str.left(pos) + guid + str.mid(pos, 99999);
|
else
|
str = str.left(pos) + L"," + guid + str.mid(pos, 99999);
|
}
|
else
|
{
|
str += tm + L":" + guid + L";";
|
}
|
|
xstring goodno = L"¿Í»§Í¼Æ¬";
|
if (tm == L"supplier-photo") goodno = L"¹©Ó¦ÉÌͼƬ";
|
xstring picname = path;
|
if (picname == L"") picname = L"/business/products/chanpin/" + guid.left(2) + L"/" + guid + L".jpg";
|
im.AddImages(picname, goodno);
|
im.Redraw();
|
dw_cell.SetItemString(row, 0, str);
|
//trace(L"\r\n"+str);
|
return 1;
|
}
|
|
int getItemCount(xstring str, xstring tm)
|
{
|
if (str.find(tm + L":") < 0) return 0;
|
int pos = str.find(L";", str.find(tm + L":") + 1);
|
if (pos < 0) pos = str.length() + 1;
|
|
xstring images = str.mid(str.find(tm + L":") + (tm + L":").length(), 99999);
|
images = images.left(pos);
|
|
int spos = 0;
|
int count = 0;
|
while (true)
|
{
|
count++;
|
spos = images.find(L",", spos + 1);
|
if (spos < 0) break;
|
}
|
trace(L" count:" + xstring(count));
|
return count;
|
}
|
|
int OnImageDel()
|
{
|
int row = dw_cell.GetRow();
|
int startRow = getItemHeadRow(dw_cell);
|
|
//ûÓÐÕÒµ½ÉÌÆ·ÐеıêÌâ
|
if (startRow < 1) return 0;
|
startRow++;
|
int colPhoto = getItemCol(dw_cell, startRow - 1, L"Photo,Customer Photo");
|
int colPhoto1 = getItemCol(dw_cell, startRow - 1, L"¹¤³§Í¼Æ¬");
|
if (row < startRow) return 0;
|
|
xstring str = dw_cell.GetItemString(row, 0);
|
xstring tm = L"customer-photo";
|
int colimage = colPhoto;
|
|
int sindex = 0;
|
int cindex = 0;
|
|
ximageview im = GetControl(L"frame:im1");
|
int index = im.GetSelectIndex();
|
if (index < 0 || index > im.GetImageCount()) return 1;
|
|
if (action == L"purch")
|
{
|
tm = L"supplier-photo";
|
colimage = colPhoto1;
|
sindex = getItemCount(str, L"customer-photo");
|
}
|
else
|
{
|
trace(L"index:" + xstring(index) + L"--" + L"cnt:" + xstring(getItemCount(str, L"customer-photo")));
|
if (index >= getItemCount(str, L"customer-photo"))
|
return 1;
|
}
|
|
if (str.find(tm + L":"))
|
{
|
//trace(xstring(index)+L"-"+xstring(sindex));
|
|
index -= sindex;
|
if (index < 0) return 1;
|
|
int pos = str.find(L";", str.find(tm + L":") + 1);
|
if (pos < 0) pos = str.length() + 1;
|
|
xstring imageurl = im.GetImageUrl(index + sindex);
|
xstring images = str.mid(str.find(tm + L":") + (tm + L":").length(), 99999);
|
images = images.left(pos);
|
int spos = 0;
|
int i = 0;
|
|
if (action != L"purch" && index == 0 && getItemCount(str, L"customer-photo") == 1)
|
{
|
images = L";";
|
}
|
else
|
{
|
while (true)
|
{
|
if (i == index) break;
|
spos = images.find(L",", spos + 1);
|
if (spos < 0) break;
|
i++;
|
}
|
int epos = images.find(L",", spos + 1);
|
if (spos >= 0)
|
{
|
if (epos < 0)
|
images = images.left(spos);
|
else
|
images = images.left(spos) + images.mid(epos, 99999);
|
}
|
if (images.right(1) != L";") images += L";";
|
}
|
|
str = str.left(str.find(tm + L":") + (tm + L":").length()) + images + str.mid(pos + 1, 99999);
|
dw_cell.SetItemString(row, 0, str);
|
|
|
if (index >= 0) im.RemoveImage(index + sindex);
|
//im.ResetEx();
|
im.Redraw();
|
if (index == 0)dw_cell.SetItemString(row, colimage, L"");
|
|
if (im.GetImageCount() - sindex >= 1)
|
{
|
if (images.find(L",") == 0) images = images.mid(1, 9999);
|
int pos1 = images.find(L",");
|
if (pos1 < 0) pos1 = images.find(L";");
|
xstring id = images;
|
if (pos1 >= 0) id = images.left(pos1);
|
|
if (id != L"")
|
{
|
xstring name = id + L".jpg";
|
|
//xstring appPath = GetModuleTmpPath();
|
//xaserver::CreateDirectory(appPath);
|
//xaserver::DownLoadFile(GetServerUrl(),L"/business/products/chanpin/"+id.left(2)+L"/"+name,name,appPath+L"/"+name);
|
|
if (startRow > 1)
|
{
|
xstring props = dw_cell.GetCellProps(row, colimage);
|
props = L"<cellprop><edit edittype='image'/></cellprop>";
|
dw_cell.SetCellProps(row, colPhoto, props);
|
dw_cell.SetItemString(row, colimage, GetImageUrl(id));
|
}
|
}
|
}
|
}
|
else
|
dw_cell.SetItemString(row, colimage, L"");
|
dw_cell.Redraw();
|
|
return 1;
|
}
|
|
int OnImageAdd1()
|
{
|
int row = dw_cell.GetRow();
|
int startRow = getItemHeadRow(dw_cell);
|
|
//ûÓÐÕÒµ½ÉÌÆ·ÐеıêÌâ
|
if (startRow < 1) return 0;
|
startRow++;
|
int colPhoto = getItemCol(dw_cell, startRow - 1, L"Photo,Customer Photo");
|
int colPhoto1 = getItemCol(dw_cell, startRow - 1, L"¹¤³§Í¼Æ¬");
|
int LastRow = dw_cell.GetValidRow();
|
if (row < startRow) return 0;
|
|
xstring props = dw_cell.GetCellProps(row, colPhoto);
|
props = L"<cellprop><edit edittype='image'/></cellprop>";
|
dw_cell.SetCellProps(row, colPhoto, props);
|
dw_cell.SetCellProps(row, colPhoto1, props);
|
|
xstring appPath = xutil::GetModuleTmpPath();
|
xstring guid = ViewObject::GetGuid();
|
xstring filename1 = UploadImage(guid);
|
if (filename1 != L"")
|
{
|
if (action == L"purch")
|
{
|
//dw_cell.SetItemString(row,colPhoto1,file);
|
AddImageTerm(row, L"supplier-photo", guid);
|
if (dw_cell.GetItemString(row, colPhoto1) == L"")
|
dw_cell.SetItemString(row, colPhoto1, appPath + L"\\" + L"x_" + guid + L".jpg");
|
}
|
else
|
{
|
//dw_cell.SetItemString(row,colPhoto,file);
|
AddImageTerm(row, L"customer-photo", guid);
|
if (dw_cell.GetItemString(row, colPhoto) == L"")
|
dw_cell.SetItemString(row, colPhoto, appPath + L"\\" + L"x_" + guid + L".jpg");
|
}
|
dw_cell.SetRowHeight(row, dw_cell.GetRowHeight(row));
|
dw_cell.Redraw();
|
Redraw();
|
}
|
|
return 1;
|
}
|
|
int GetOpenFileNames(xarray<xstring>& items, xstring initFileName, const string filter, xstring ext)
|
{
|
//xstring path = GetOpenFileName(L"",
|
// "JPEG Îļþ(*.jpg)\0*.jpg;*.jpeg;*.png;*.gif;*.bmp\0È«²¿Îļþ(*.*)\0*.*\0",
|
// "jpg");
|
|
wchar_t szFileName[4096];
|
wchar_t szPath[4096];
|
szFileName[0] = 0;
|
szPath[0] = 0;
|
|
if (initFileName != L"")
|
{
|
int len = initFileName.length();
|
const wchar_t* tmp = initFileName.c_str();
|
for (int i = 0; i < len + 1; i++)
|
{
|
szPath[i] = tmp[i];
|
}
|
}
|
|
int nFilterIndex = 1;
|
OPENFILENAMEW ofn;
|
|
ofn.lStructSize = sizeof(ofn);
|
ofn.hwndOwner = 0;
|
ofn.hInstance = 0;
|
ofn.lpstrFilter = filter;
|
//"JPEG Îļþ(*.jpg)\0*.jpg;*.jpeg;*.png;*.gif;*.bmp\0È«²¿Îļþ(*.*)\0*.*\0";
|
ofn.lpstrCustomFilter = 0;
|
ofn.nMaxCustFilter = 0;
|
ofn.nFilterIndex = nFilterIndex;
|
ofn.lpstrFile = szPath;
|
ofn.nMaxFile = 4096;
|
ofn.lpstrFileTitle = szFileName;
|
ofn.nMaxFileTitle = 4096;
|
ofn.lpstrTitle = L"ÇëÖ¸¶¨ÎļþÃû";
|
ofn.lpstrDefExt = ext;
|
//"jpg";
|
ofn.lpstrInitialDir = 0;
|
ofn.Flags = 0x00000010/*OFN_SHOWHELP*/ | 0x00001000/*OFN_FILEMUSTEXIST*/
|
| 0x00000200 /*OFN_ALLOWMULTISELECT*/ | 0x00080000 /*OFN_EXPLORER*/;
|
ofn.lCustData = 0;
|
ofn.lpfnHook = 0;
|
ofn.lpTemplateName = 0;
|
|
ofn.nFileOffset = 0;
|
ofn.nFileExtension = 0;
|
|
//debugbreak();
|
if (xfile::GetOpenFileName(ofn))
|
{
|
int pos = ofn.nFileOffset & 0xffff;
|
xstring path = szPath;
|
if (pos < path.length()) //select one
|
{
|
items.push_back(path + L"");
|
}
|
else
|
{
|
wchar_t* start = szPath;
|
start += pos;;
|
xstring str = start;
|
while (true)
|
{
|
if (str == L"")break;
|
items.push_back(path + L"/" + str);
|
start += (str.length() + 1) ;
|
str = start;
|
}
|
}
|
}
|
return items.length();
|
}
|
|
int OnImageAddEx()
|
{
|
int row = dw_cell.GetRow();
|
int startRow = getItemHeadRow(dw_cell);
|
|
//ûÓÐÕÒµ½ÉÌÆ·ÐеıêÌâ
|
if (startRow < 1) return 0;
|
startRow++;
|
int colPhoto = getItemCol(dw_cell, startRow - 1, L"Photo,Customer Photo");
|
int colPhoto1 = getItemCol(dw_cell, startRow - 1, L"¹¤³§Í¼Æ¬");
|
int LastRow = dw_cell.GetValidRow();
|
if (row < startRow) return 0;
|
|
xstring appPath = xutil::GetModuleTmpPath();
|
xarray<xstring> items;
|
GetOpenFileNames(items, L"",
|
L"JPEG Îļþ(*.jpg)\0*.jpg;*.jpeg;*.png;*.gif;*.bmp\0È«²¿Îļþ(*.*)\0*.*\0",
|
L"jpg");
|
if (items.length() < 1) return 1;
|
|
int sRow = row;
|
for (int i = 0; i < items.length(); i++)
|
{
|
row = sRow + i;
|
xstring props = dw_cell.GetCellProps(row, colPhoto);
|
props = L"<cellprop><edit edittype='image'/></cellprop>";
|
dw_cell.SetCellProps(row, colPhoto, props);
|
dw_cell.SetCellProps(row, colPhoto1, props);
|
|
xstring guid = ViewObject::GetGuid();
|
xstring filename1 = UploadImage(guid, items.item(i));
|
int rowheight = dw_cell.GetRowHeight(row);
|
if (rowheight < 50) rowheight = 50;
|
if (filename1 != L"")
|
{
|
if (action == L"purch")
|
{
|
//dw_cell.SetItemString(row,colPhoto1,file);
|
if (i == 0)
|
AddImageTerm(row, L"supplier-photo", guid);
|
else
|
AddImageTermEx(row, L"supplier-photo", guid);
|
if (dw_cell.GetItemString(row, colPhoto1) == L"")
|
{
|
//dw_cell.SetItemString(row,colPhoto1,appPath+L"\\"+L"x_"+guid+L".jpg");
|
dw_cell.SetItemString(row, colPhoto1, GetImageUrl(guid));
|
dw_cell.SetRowHeight(row, rowheight);
|
}
|
}
|
else
|
{
|
//dw_cell.SetItemString(row,colPhoto,file);
|
if (i == 0)
|
AddImageTerm(row, L"customer-photo", guid);
|
else
|
AddImageTermEx(row, L"customer-photo", guid);
|
if (dw_cell.GetItemString(row, colPhoto) == L"")
|
{
|
//dw_cell.SetItemString(row,colPhoto,appPath+L"\\"+L"x_"+guid+L".jpg");
|
dw_cell.SetItemString(row, colPhoto, GetImageUrl(guid));
|
dw_cell.SetRowHeight(row, rowheight);
|
}
|
}
|
}
|
//dw_cell.SetRowHeight(row,dw_cell.GetRowHeight(row));
|
dw_cell.Redraw();
|
Redraw();
|
}
|
|
return 1;
|
}
|
|
int OnImageAdd()
|
{
|
int row = dw_cell.GetRow();
|
int startRow = getItemHeadRow(dw_cell);
|
|
//ûÓÐÕÒµ½ÉÌÆ·ÐеıêÌâ
|
if (startRow < 1) return 0;
|
startRow++;
|
int colPhoto = getItemCol(dw_cell, startRow - 1, L"Photo,Customer Photo");
|
int colPhoto1 = getItemCol(dw_cell, startRow - 1, L"¹¤³§Í¼Æ¬");
|
int LastRow = dw_cell.GetValidRow();
|
if (row < startRow) return 0;
|
|
xstring props = dw_cell.GetCellProps(row, colPhoto);
|
props = L"<cellprop><edit edittype='image'/></cellprop>";
|
dw_cell.SetCellProps(row, colPhoto, props);
|
dw_cell.SetCellProps(row, colPhoto1, props);
|
|
xstring appPath = xutil::GetModuleTmpPath();
|
xarray<xstring> items;
|
GetOpenFileNames(items, L"",
|
L"JPEG Îļþ(*.jpg)\0*.jpg;*.jpeg;*.png;*.gif;*.bmp\0È«²¿Îļþ(*.*)\0*.*\0",
|
L"jpg");
|
if (items.length() < 1) return 1;
|
|
for (int i = 0; i < items.length(); i++)
|
{
|
xstring guid = ViewObject::GetGuid();
|
xstring filename1 = UploadImage(guid, items.item(i));
|
int rowheight = dw_cell.GetRowHeight(row);
|
if (rowheight < 50) rowheight = 50;
|
if (action == L"purch")
|
{
|
//dw_cell.SetItemString(row,colPhoto1,file);
|
AddImageTerm(row, L"supplier-photo", guid);
|
if (dw_cell.GetItemString(row, colPhoto1) == L"")
|
{
|
//dw_cell.SetItemString(row,colPhoto1,appPath+L"\\"+L"x_"+guid+L".jpg");
|
dw_cell.SetItemString(row, colPhoto1, GetImageUrl(guid));
|
dw_cell.SetRowHeight(row, rowheight);
|
}
|
}
|
else
|
{
|
//dw_cell.SetItemString(row,colPhoto,file);
|
AddImageTerm(row, L"customer-photo", guid);
|
if (dw_cell.GetItemString(row, colPhoto) == L"")
|
{
|
//dw_cell.SetItemString(row,colPhoto,appPath+L"\\"+L"x_"+guid+L".jpg");
|
dw_cell.SetItemString(row, colPhoto, GetImageUrl(guid));
|
dw_cell.SetRowHeight(row, rowheight);
|
}
|
}
|
//dw_cell.SetRowHeight(row,dw_cell.GetRowHeight(row));
|
dw_cell.Redraw();
|
Redraw();
|
}
|
|
return 1;
|
}
|
|
|
int ReCalcPOPrice()
|
{
|
int startRow = getItemHeadRow(dw_cell);
|
if (startRow < 1) return 1;
|
startRow++;
|
|
int sRow = dw_cell.GetRow();
|
int eRow = dw_cell.GetAnchorRow();
|
int sCol = dw_cell.GetColumn();
|
int eCol = dw_cell.GetAnchorCol();
|
auto Exchange = [](int& first, int& second)
|
{
|
int tmp = first;first = second;second = tmp;
|
};
|
if (sRow > eRow)Exchange(sRow, eRow);
|
if (sCol > eCol)Exchange(sCol, eCol);
|
|
if (action != L"purch") return 1;
|
|
if (sRow < startRow && eRow < startRow) return 1;
|
if (sRow < startRow) sRow = startRow;
|
int colPrice0 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ");
|
int colPrice1 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ1");
|
int colPrice2 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ2");
|
int colPrice3 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ3");
|
int colPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û");
|
int colSKUID = getItemCol(dw_cell, startRow - 1, L"SKUID");
|
bool shouldRedraw = false;
|
|
if ((colPrice0 >= sCol && colPrice0 <= eCol) || (colPrice1 >= sCol && colPrice1 <= eCol)
|
|| (colPrice2 >= sCol && colPrice2 <= eCol) || (colPrice3 >= sCol && colPrice3 <= eCol))
|
{
|
for (int row = sRow; row <= eRow; row++)
|
{
|
if (dw_cell.GetItemString(row, colSKUID) == L"")continue;
|
for (int col = sCol; col <= eCol; col++)
|
{
|
if (colPrice0 == col || colPrice1 == col || colPrice2 == col || colPrice3 == col)
|
{
|
xstring pricea = L"";
|
xstring priceb = L"";
|
xstring pricec = L"";
|
|
xstring price0 = dw_cell.GetItemString(row, colPrice0);
|
xstring price1 = dw_cell.GetItemString(row, colPrice1);
|
xstring price2 = L"";
|
if (colPrice2 > 0) price2 = dw_cell.GetItemString(row, colPrice2);
|
xstring price3 = L"";
|
if (colPrice3 > 0) price3 = dw_cell.GetItemString(row, colPrice3);
|
|
xstring price = L"";
|
|
if (price0 != L"")
|
{
|
price = price0;
|
if (price.find(L"A") < 1 && price.find(L"B") < 1 && price.find(L"C") < 1 && price.find(L"a") < 1 && price.find(L"b") < 1 && price.find(L"b") < 1)
|
{
|
alert(L"¼Û¸ñÖÐûָ¶¨ABC");
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
}
|
else if (price.find(L"A") > 0 || price.find(L"a") > 0)
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
else if (price.find(L"B") > 0 || price.find(L"b") > 0)
|
if (priceb == L"") priceb = price; else priceb += L"+" + price;
|
else if (price.find(L"C") > 0 || price.find(L"c") > 0)
|
if (pricec == L"") pricec = price; else pricec += L"+" + price;
|
}
|
if (price1 != L"")
|
{
|
price = price1;
|
if (price.find(L"A") < 1 && price.find(L"B") < 1 && price.find(L"C") < 1 && price.find(L"a") < 1 && price.find(L"b") < 1 && price.find(L"b") < 1)
|
{
|
alert(L"¼Û¸ñÖÐûָ¶¨ABC");
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
}
|
else if (price.find(L"A") > 0 || price.find(L"a") > 0)
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
else if (price.find(L"B") > 0 || price.find(L"b") > 0)
|
if (priceb == L"") priceb = price; else priceb += L"+" + price;
|
else if (price.find(L"C") > 0 || price.find(L"c") > 0)
|
if (pricec == L"") pricec = price; else pricec += L"+" + price;
|
}
|
if (price2 != L"")
|
{
|
price = price2;
|
if (price.find(L"A") < 1 && price.find(L"B") < 1 && price.find(L"C") < 1 && price.find(L"a") < 1 && price.find(L"b") < 1 && price.find(L"b") < 1)
|
{
|
alert(L"¼Û¸ñÖÐûָ¶¨ABC");
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
}
|
else if (price.find(L"A") > 0 || price.find(L"a") > 0)
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
else if (price.find(L"B") > 0 || price.find(L"b") > 0)
|
if (priceb == L"") priceb = price; else priceb += L"+" + price;
|
else if (price.find(L"C") > 0 || price.find(L"c") > 0)
|
if (pricec == L"") pricec = price; else pricec += L"+" + price;
|
}
|
if (price3 != L"")
|
{
|
price = price3;
|
if (price.find(L"A") < 1 && price.find(L"B") < 1 && price.find(L"C") < 1 && price.find(L"a") < 1 && price.find(L"b") < 1 && price.find(L"b") < 1)
|
{
|
alert(L"¼Û¸ñÖÐûָ¶¨ABC");
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
}
|
else if (price.find(L"A") > 0 || price.find(L"a") > 0)
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
else if (price.find(L"B") > 0 || price.find(L"b") > 0)
|
if (priceb == L"") priceb = price; else priceb += L"+" + price;
|
else if (price.find(L"C") > 0 || price.find(L"c") > 0)
|
if (pricec == L"") pricec = price; else pricec += L"+" + price;
|
}
|
price = pricec;
|
if (priceb != L"")
|
{
|
if (price == L"")
|
price = priceb;
|
else
|
price += L"+" + priceb;
|
}
|
if (pricea != L"")
|
{
|
if (price == L"")
|
price = pricea;
|
else
|
price += L"+" + pricea;
|
}
|
dw_cell.SetItemString(row, colPrice, price);
|
shouldRedraw = true;
|
|
}
|
}
|
}
|
}
|
if(shouldRedraw)dw_cell.Redraw();
|
return 1;
|
}
|
|
int OnCellItemChanged(TEvent* evt, LPARAM p)
|
{
|
CELLNMHDR& hdr = *(CELLNMHDR*)evt->notify.pnmh;
|
xstring value = hdr.data;
|
int row = hdr.currentrow;
|
int col = hdr.currentcol;
|
|
|
trace(L"\r\n----row:" + xstring(row) + L"--col:" + xstring(col));
|
trace(L"\r\n----row:" + xstring(row) + L"--col:" + xstring(col));
|
trace(L"\r\n--value:" + dw_cell.GetItemString(row, col) + L"--orig:" + orivalue);
|
//if (row == ARow && col == ACol && dw_cell.GetItemString(row, col) == orivalue) return 1;
|
trace(L"\r\n--enter:");
|
|
ARow = row;
|
ACol = col;
|
orivalue = dw_cell.GetItemString(ARow, ACol) + L"";
|
|
int startRow = getItemHeadRow(dw_cell);
|
if (startRow < 1) return 1;
|
if (row < startRow + 1) return 1;
|
startRow++;
|
|
int colItemNo = getItemCol(dw_cell, startRow - 1, L"ÎÒ˾ÐͺÅ,ItemNo");
|
int colCustomerItemNo = getItemCol(dw_cell, startRow - 1, L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(dw_cell, startRow - 1, L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(dw_cell, startRow - 1, L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(dw_cell, startRow - 1, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colBuyerPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û,²É¹º¼Û¸ñ");
|
int colBuyer = getItemCol(dw_cell, startRow - 1, L"²É¹ºÈËÔ±");
|
int colCustomerPhoto = getItemCol(dw_cell, startRow - 1, L"Photo,Customer Photo");
|
int colPackage = getItemCol(dw_cell, startRow - 1, L"Package,°ü×°·½Ê½");
|
int colFOBPrice = getItemCol(dw_cell, startRow - 1, L"FOB Price,FOB Price(USD),Fob Price");
|
int colQty = getItemCol(dw_cell, startRow - 1, L"Qty,ÊýÁ¿");
|
//int colToPODate = getItemCol(dw_cell,startRow - 1,L"ÒµÎñ·¢ËͲɹºÊ±¼ä");
|
|
|
int colVolDesc = getItemCol(dw_cell, startRow - 1, L"Ìå»ýÃèÊö,³¤X¿íX¸ß,³¤X¿íX¸ß(CM)");
|
int colVol = getItemCol(dw_cell, startRow - 1, L"Ìå»ý,Ìå»ý(M3)");
|
int colQtyPerPack = getItemCol(dw_cell, startRow - 1, L"×°ÏäÊý(ÄÚ/Íâ),×°ÏäÊý(Íâ/ÄÚ)");
|
int col40HQ = getItemCol(dw_cell, startRow - 1, L"40HQ,QTY(40HQ)");
|
int colSKUID = getItemCol(dw_cell, startRow - 1, L"SKUID");
|
|
int colPONote = getItemCol(dw_cell, startRow - 1, L"²É¹ºToÒµÎñ±¸×¢");
|
int colPOPhoto = getItemCol(dw_cell, startRow - 1, L"¹¤³§Í¼Æ¬");
|
int colPOPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û");
|
int colNW = getItemCol(dw_cell, startRow - 1, L"Ã«ÖØ(KG)");
|
int colGW = getItemCol(dw_cell, startRow - 1, L"¾»ÖØ(KG)");
|
int colSKUNo = getItemCol(dw_cell, startRow - 1, L"SKUID,SKUNo");
|
|
if (col == colFOBPrice)
|
{
|
xstring fobprice = dw_cell.GetItemString(row, col);
|
if (fobprice.find(L"$") >= 0)fobprice = fobprice.mid(1, 999);
|
trace(L"+++++L" + fobprice + L"+++++L");
|
double colFOBPriceEx = fobprice.toDouble();
|
|
double colFOBPriceS;
|
colFOBPriceS = xdouble(colFOBPriceEx).round(2);
|
xstring colFOBPriceS1 = xstring(colFOBPriceS);
|
xstring colFOBPriceS2 = colFOBPriceS1.left(colFOBPriceS1.find(L"."));
|
xstring colFOBPriceS3 = colFOBPriceS1.mid(colFOBPriceS1.find(L"."), colFOBPriceS1.length());
|
xstring colFOBPriceS4 = colFOBPriceS3.mid(1, 2);
|
trace(L"******" + colFOBPriceS1 + L"****" + colFOBPriceS2 + L"****" + colFOBPriceS3 + L"****" + colFOBPriceS4 + L"****");
|
|
if (fobprice != L"")dw_cell.SetItemString(row, col, L"$" + colFOBPriceS2 + L"." + colFOBPriceS4);
|
return 1;
|
}
|
|
if (col == colItemNo)
|
{
|
if (dw_cell.GetItemString(row, colItemNo) != L"")
|
{
|
xaserverarg argx ;
|
|
argx.AddArg(L"GoodsNo", dw_cell.GetItemString(row, colItemNo));
|
OpenWindow(L"dev:xpage[CustomerItemNoList.vx]", argx);
|
if (argx.GetArgString(L"action") != L"ok") return 1;
|
|
xml x1 ;
|
x1.loadXML(argx.GetArgString(L"items"));
|
if (x1.selectSingleNode(L"//CustomerItemNo"))
|
{
|
xstring CustomerItemNo = x1.selectSingleNode(L"//CustomerItemNo").text();
|
dw_cell.SetItemString(row, colCustomerItemNo, CustomerItemNo);
|
}
|
|
xml goods = GetProduct(dw_cell.GetItemString(row, colItemNo));
|
|
if (goods)
|
{
|
dw_cell.SetItemString(row, colCustomerPhoto, L"");
|
resetRowTerm(dw_cell, row, L"customer-photo");
|
if (goods.selectSingleNode(L"//SKUID[1]"))
|
{
|
setRowProp(dw_cell, row, L"SKUID", goods.selectSingleNode(L"//SKUID[1]").text());
|
}
|
if (goods.selectSingleNode(L"//SKUNo[1]"))
|
{
|
dw_cell.SetItemString(row, colSKUNo, goods.selectSingleNode(L"//SKUNo[1]").text());
|
}
|
if (goods.selectSingleNode(L"//EName[1]"))
|
dw_cell.SetItemString(row, colItemName, goods.selectSingleNode(L"//EName[1]").text());
|
if (goods.selectSingleNode(L"//CName[1]"))
|
dw_cell.SetItemString(row, colItemCName, goods.selectSingleNode(L"//CName[1]").text());
|
if (goods.selectSingleNode(L"//Packing[1]"))
|
dw_cell.SetItemString(row, colPackage, goods.selectSingleNode(L"//Packing[1]").text());
|
if (goods.selectSingleNode(L"//POCreatorID[1]"))
|
{
|
dw_cell.SetItemString(row, colBuyer, goods.selectSingleNode(L"//POCreatorID[1]").text());
|
}
|
if (goods.selectSingleNode(L"//PackingRate[1]"))
|
{
|
if (goods.selectSingleNode(L"//InnerQty[1]"))
|
{
|
xstring str1 = goods.selectSingleNode(L"//PackingRate[1]").text();
|
xstring str2 = goods.selectSingleNode(L"//InnerQty[1]").text();
|
dw_cell.SetItemString(row, colQtyPerPack, str2 + L"/" + str1);
|
}
|
else
|
{
|
xstring str1 = goods.selectSingleNode(L"//PackingRate[1]").text();
|
dw_cell.SetItemString(row, colQtyPerPack, str1);
|
}
|
}
|
ProcessItemImage(dw_cell.GetItemString(row, colSKUNo), row);
|
//ProcessItemImage1(dw_cell.GetItemString(row,colItemNo),row);
|
dw_cell.SetRowColumn(row, col);
|
dw_cell.SetAnchorRowColumn(row, col);
|
|
dw_cell.Redraw();
|
}
|
}
|
}
|
|
if (col == colVolDesc || col == colQtyPerPack)
|
{
|
/*¼ÆËãÌå»ý*/
|
double v = 0.0;
|
xstring desc = dw_cell.GetItemString(row, colVolDesc);
|
if(desc!=L"")
|
{
|
if (desc.find(L"cm") >= 0)
|
{
|
desc = desc.replace(L"cm", L"");
|
dw_cell.SetItemString(row, colVolDesc, desc);
|
}
|
if (desc.find(L"CM") >= 0)
|
{
|
desc = desc.replace(L"CM", L"");
|
dw_cell.SetItemString(row, colVolDesc, desc);
|
}
|
if (desc == L"")
|
dw_cell.SetItemString(row, colVol, L"");
|
else
|
{
|
v = calcVol(desc) / 1000000.00;
|
xstring str = xstring(v);
|
if (str.find(L".") >= 0) str = str.left(str.find(L".") + 5);
|
dw_cell.SetItemString(row, colVol, str);
|
dw_cell.Redraw();
|
}
|
|
xstring qtyperPack = dw_cell.GetItemString(row, colQtyPerPack);
|
if (qtyperPack != L"")
|
{
|
xstring qty1 = qtyperPack;
|
xstring qty2 = L"";
|
double qty = 0.00;
|
int pos2 = qtyperPack.find(L"/");
|
if (pos2 >= 0)
|
{
|
qty1 = qtyperPack.left(qtyperPack.find(L"/"));
|
qty2 = qtyperPack.mid(qtyperPack.find(L"/") + 1, 9999);
|
}
|
//if(qty1 !=L"") qty = qty1.toDouble();
|
//if(qty2 !=L"") qty = qty*qty2.toDouble();
|
if (qty2 != L"")
|
{
|
qty = qty2.toDouble();
|
double ttl = 65.0 * qty / v;
|
dw_cell.SetItemString(row, col40HQ, xstring((int)ttl));
|
}
|
}
|
}
|
}
|
|
if (action == L"purch")
|
{
|
int colPrice0 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ");
|
int colPrice1 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ1");
|
int colPrice2 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ2");
|
int colPrice3 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ3");
|
int colPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û");
|
|
int colTyp = getItemCol(dw_cell, startRow - 1, L"ÀàÐÍ");
|
int colTyp1 = getItemCol(dw_cell, startRow - 1, L"ÀàÐÍ1");
|
int colTyp2 = getItemCol(dw_cell, startRow - 1, L"ÀàÐÍ2");
|
int colTyp3 = getItemCol(dw_cell, startRow - 1, L"ÀàÐÍ3");
|
int colSupplier = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ,¹¤³§");
|
int colSupplier1 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ1,¹¤³§1");
|
int colSupplier2 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ2,¹¤³§2");
|
int colSupplier3 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ3,¹¤³§3");
|
|
if (colPrice0 == col || colPrice1 == col || colPrice2 == col || colPrice3 == col)
|
{
|
trace(L"\r\n---*****---hit col:" + xstring(col) + L"----");
|
xstring pricea = L"";
|
xstring priceb = L"";
|
xstring pricec = L"";
|
if (action == L"purch")
|
{
|
xstring price0 = dw_cell.GetItemString(row, colPrice0);
|
xstring price1 = dw_cell.GetItemString(row, colPrice1);
|
xstring price2 = L"";
|
if (colPrice2 > 0) price2 = dw_cell.GetItemString(row, colPrice2);
|
xstring price3 = L"";
|
if (colPrice3 > 0) price3 = dw_cell.GetItemString(row, colPrice3);
|
|
xstring price = L"";
|
|
if (price0 != L"")
|
{
|
price = price0;
|
if (price.find(L"A") < 1 && price.find(L"B") < 1 && price.find(L"C") < 1 && price.find(L"a") < 1 && price.find(L"b") < 1 && price.find(L"b") < 1)
|
{
|
alert(L"¼Û¸ñÖÐûָ¶¨ABC");
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
}
|
else if (price.find(L"A") > 0 || price.find(L"a") > 0)
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
else if (price.find(L"B") > 0 || price.find(L"b") > 0)
|
if (priceb == L"") priceb = price; else priceb += L"+" + price;
|
else if (price.find(L"C") > 0 || price.find(L"c") > 0)
|
if (pricec == L"") pricec = price; else pricec += L"+" + price;
|
}
|
if (price1 != L"")
|
{
|
price = price1;
|
if (price.find(L"A") < 1 && price.find(L"B") < 1 && price.find(L"C") < 1 && price.find(L"a") < 1 && price.find(L"b") < 1 && price.find(L"b") < 1)
|
{
|
alert(L"¼Û¸ñÖÐûָ¶¨ABC");
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
}
|
else if (price.find(L"A") > 0 || price.find(L"a") > 0)
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
else if (price.find(L"B") > 0 || price.find(L"b") > 0)
|
if (priceb == L"") priceb = price; else priceb += L"+" + price;
|
else if (price.find(L"C") > 0 || price.find(L"c") > 0)
|
if (pricec == L"") pricec = price; else pricec += L"+" + price;
|
}
|
if (price2 != L"")
|
{
|
price = price2;
|
if (price.find(L"A") < 1 && price.find(L"B") < 1 && price.find(L"C") < 1 && price.find(L"a") < 1 && price.find(L"b") < 1 && price.find(L"b") < 1)
|
{
|
alert(L"¼Û¸ñÖÐûָ¶¨ABC");
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
}
|
else if (price.find(L"A") > 0 || price.find(L"a") > 0)
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
else if (price.find(L"B") > 0 || price.find(L"b") > 0)
|
if (priceb == L"") priceb = price; else priceb += L"+" + price;
|
else if (price.find(L"C") > 0 || price.find(L"c") > 0)
|
if (pricec == L"") pricec = price; else pricec += L"+" + price;
|
}
|
if (price3 != L"")
|
{
|
price = price3;
|
if (price.find(L"A") < 1 && price.find(L"B") < 1 && price.find(L"C") < 1 && price.find(L"a") < 1 && price.find(L"b") < 1 && price.find(L"b") < 1)
|
{
|
alert(L"¼Û¸ñÖÐûָ¶¨ABC");
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
}
|
else if (price.find(L"A") > 0 || price.find(L"a") > 0)
|
if (pricea == L"") pricea = price; else pricea += L"+" + price;
|
else if (price.find(L"B") > 0 || price.find(L"b") > 0)
|
if (priceb == L"") priceb = price; else priceb += L"+" + price;
|
else if (price.find(L"C") > 0 || price.find(L"c") > 0)
|
if (pricec == L"") pricec = price; else pricec += L"+" + price;
|
}
|
price = pricec;
|
if (priceb != L"")
|
{
|
if (price == L"")
|
price = priceb;
|
else
|
price += L"+" + priceb;
|
}
|
if (pricea != L"")
|
{
|
if (price == L"")
|
price = pricea;
|
else
|
price += L"+" + pricea;
|
}
|
dw_cell.SetItemString(row, colPrice, price);
|
dw_cell.Redraw();
|
}
|
}
|
}
|
|
return 1;
|
}
|
|
int OnCellSelectChanged(TEvent*, LPARAM p)
|
{
|
/*ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR);
|
xstring colname=hdr.colname;
|
xstring value = hdr.data;
|
int row = hdr.row;
|
*/
|
trace(L"========111============L");
|
return 1;
|
}
|
|
int OnItemChanged(TEvent* evt, LPARAM p)
|
{
|
DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
|
xstring colname = hdr.colname;
|
xstring value = hdr.data;
|
int row = hdr.row;
|
|
if (colname == L"Project")
|
{
|
|
setBaseItem(dw_cell, L"ÏîÄ¿Ãû³Æ:", value);
|
}
|
return 1;
|
}
|
|
int OnToQuote()
|
{
|
xstring project = getBaseItem(dw_cell, L"ÏîÄ¿Ãû³Æ:");
|
if (project != L"")dw_base.SetItemString(1, L"Project", project);
|
|
int startRow = getItemHeadRow(dw_cell);
|
|
//ûÓÐÕÒµ½ÉÌÆ·ÐеıêÌâ
|
if (startRow < 1) return 0;
|
startRow++;
|
|
int colItemNo = getItemCol(dw_cell, startRow - 1, L"ÎÒ˾ÐͺÅ,ItemNo");
|
int colCustomerItemNo = getItemCol(dw_cell, startRow - 1, L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(dw_cell, startRow - 1, L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(dw_cell, startRow - 1, L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(dw_cell, startRow - 1, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
|
int colTechNote = getItemCol(dw_cell, startRow - 1, L"ÒµÎñ²¿²úÆ·ÐÅÏ¢");
|
int colTechNote1 = getItemCol(dw_cell, startRow - 1, L"²É¹º²¿²úÆ·ÐÅÏ¢");
|
|
|
|
int colBuyerPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û,²É¹º¼Û¸ñ");
|
int colPackage = getItemCol(dw_cell, startRow - 1, L"Package");
|
int colPurchor = getItemCol(dw_cell, startRow - 1, L"²É¹ºÔ±,²É¹ºÈËÔ±");
|
int colQtyPerPack = getItemCol(dw_cell, startRow - 1, L"×°ÏäÊý(ÄÚ/Íâ)");
|
int colFOBPrice = getItemCol(dw_cell, startRow - 1, L"FOB Price,FOB Price(USD),Fob Price");
|
int colQuantity = getItemCol(dw_cell, startRow - 1, L"ÊýÁ¿,Qty");
|
|
int colBuyerMOQ = getItemCol(dw_cell, startRow - 1, L"MOQ");
|
int colBuyerRemark = getItemCol(dw_cell, startRow - 1, L"²É¹ºToÒµÎñ±¸×¢");
|
int colFactoryImage = getItemCol(dw_cell, startRow - 1, L"¹¤³§Í¼Æ¬");
|
int colGWT = getItemCol(dw_cell, startRow - 1, L"Ã«ÖØ,Ã«ÖØ(KG)");
|
int colNWT = getItemCol(dw_cell, startRow - 1, L"¾»ÖØ,¾»ÖØ(KG)");
|
int colVolDesc = getItemCol(dw_cell, startRow - 1, L"Ìå»ýÃèÊö,³¤X¿íX¸ß,³¤X¿íX¸ß(CM)");
|
int colVol = getItemCol(dw_cell, startRow - 1, L"Ìå»ý,Ìå»ý(M3)");
|
int colHQ = getItemCol(dw_cell, startRow - 1, L"40HQ,QTY(40HQ)");
|
int colSKUNo = getItemCol(dw_cell, startRow - 1, L"SKUID,SKUNo");
|
|
|
|
ensureRowID();
|
int LastRow = dw_cell.GetValidRow();
|
xstring content = L"";
|
for (int row = startRow; row <= LastRow; row++)
|
{
|
xstring rowid = getRowID(dw_cell, row);
|
if (rowid == L"")continue;
|
if (dw_cell.GetItemString(row, colItemName) == L"")
|
{
|
if (dw_cell.GetItemString(row, colItemCName) == L"") break;
|
}
|
int i = 1;
|
for (i = 1; i <= dw_goods.GetRowCount(); i++)
|
{
|
if (dw_goods.GetGuid(i) == rowid) break;
|
}
|
if (i > dw_goods.GetRowCount())
|
{
|
dw_goods.InsertRow(0);
|
KXMLDOMElement e = dw_goods.GetRowElement(i);
|
e.setAttribute(L"guid", rowid);
|
}
|
|
xstring SKUID = getRowProp(dw_cell, row, L"SKUID");
|
if (SKUID != L"")
|
{
|
dw_goods.SetItemString(i, L"SKUID", SKUID);
|
dw_goods.SetItemString(i, L"ItemID", SKUID);
|
}
|
dw_goods.SetItemString(i, L"SKUNo", dw_cell.GetItemString(row, colSKUNo));
|
//dw_goods.SetItemString(i,L"ItemID",dw_cell.GetItemNoteString(row,colSKUNo));
|
|
dw_goods.SetItemString(i, L"CustomerItemNo", dw_cell.GetItemString(row, colCustomerItemNo));
|
dw_goods.SetItemString(i, L"GoodsNo", dw_cell.GetItemString(row, colItemNo));
|
dw_goods.SetItemString(i, L"ItemName", dw_cell.GetItemString(row, colItemName));
|
dw_goods.SetItemString(i, L"CItemName", dw_cell.GetItemString(row, colItemCName));
|
dw_goods.SetItemString(i, L"CName", dw_cell.GetItemString(row, colItemCName));
|
|
dw_goods.SetItemString(i, L"TechNote", dw_cell.GetItemString(row, colTechNote));
|
dw_goods.SetItemString(i, L"TechNote1", dw_cell.GetItemString(row, colTechNote1));
|
dw_goods.SetItemString(i, L"ProductDesc", dw_cell.GetItemString(row, colItemName));
|
|
dw_goods.SetItemString(i, L"Packing", dw_cell.GetItemString(row, colPackage));
|
dw_goods.SetItemString(i, L"VolumeDesc", dw_cell.GetItemString(row, colVolDesc));
|
dw_goods.SetItemString(i, L"Packages45H", dw_cell.GetItemString(row, colHQ));
|
dw_goods.SetItemString(i, L"ItemMiniQty", dw_cell.GetItemString(row, colQuantity));
|
|
if (getRowTerm(dw_cell, row, L"EnquiryLineID") != L"")
|
{
|
dw_goods.SetItemString(i, L"EnquiryPriceListID", getRowTerm(dw_cell, row, L"EnquiryLineID"));
|
dw_goods.SetItemString(i, L"EnquiryLineID", getRowTerm(dw_cell, row, L"EnquiryLineID"));
|
}
|
|
//dw_goods.SetItemString(i,L"Packages45H",dw_cell.GetItemString(row,colHQ));
|
//dw_goods.SetItemString(i,L"POPrice",dw_cell.GetItemString(row,colBuyerPrice));
|
|
|
xstring FobUnitPriceEx = dw_cell.GetItemString(row, colFOBPrice);
|
if (FobUnitPriceEx == L"$") FobUnitPriceEx = L"";
|
if (FobUnitPriceEx.find(L"$") >= 0) FobUnitPriceEx = FobUnitPriceEx.right(FobUnitPriceEx.length() - 1);
|
trace(FobUnitPriceEx);
|
//dw_goods.SetItemString(i,L"FobUnitPrice",dw_cell.GetItemString(row,colFOBPrice));
|
dw_goods.SetItemString(i, L"FobUnitPrice", FobUnitPriceEx);
|
|
|
dw_goods.SetItemDisplayString(i, L"POCreatorID", dw_cell.GetItemString(row, colPurchor));
|
dw_goods.SetItemString(i, L"POCreatorID", GetPurchorByName(dw_cell.GetItemString(row, colPurchor)));
|
|
|
xstring QtyPerPack = dw_cell.GetItemString(row, colQtyPerPack);
|
xstring outer = QtyPerPack;
|
if (QtyPerPack.find(L"/") >= 0) outer = QtyPerPack.left(QtyPerPack.find(L"/"));
|
xstring inner = L"";
|
if (QtyPerPack.find(L"/") >= 0) inner = QtyPerPack.mid(QtyPerPack.find(L"/") + 1, 9999);
|
dw_goods.SetItemString(i, L"InnerQty", outer);
|
dw_goods.SetItemString(i, L"Packages", inner);
|
|
dw_goods.Redraw();
|
}
|
int crow = dw_goods.GetRow();
|
if (crow > 0)
|
{
|
OnQuoteLineChanged(crow);
|
//OnShowImage(dw_goods.GetItemString(crow,L"SKUNo"),crow);
|
}
|
|
return 1;
|
}
|
|
int ProcessItemImage(xstring goodsno, int row)
|
{
|
xml xp ;
|
xaserverarg arg_pic ;
|
|
arg_pic.AddArg(L"SKUNo", goodsno);
|
|
ximageview im = GetControl(L"frame:im1");
|
im.Reset();
|
xstring res = L"/sale/data/productlibrary3/pref/picture/imagelistskuno";
|
if (xurl::get(res, arg_pic.GetString(), xp) != 1)
|
{
|
trace(xp.xml());
|
return 1;
|
}
|
else
|
{
|
//alert(xp.xml());
|
ClearImageTerm(row, L"customer-photo");
|
//alert(xp.xml());
|
KXMLDOMNodeList nlistp = xp.selectNodes(L"ImageList/image");
|
int lenp = nlistp.length();
|
int ip = 0;
|
if (lenp > 0) lenp = 1;
|
for (ip = 0; ip < lenp; ip++)
|
{
|
KXMLDOMNode xitem = nlistp.item(ip);
|
xstring id = xitem.selectSingleNode(L"@guid").text();
|
xstring path = L"";
|
if (xitem.selectSingleNode(L"PicPath")) path = xitem.selectSingleNode(L"PicPath").text();
|
xstring name = id + L".jpg";
|
if (path == L"") path = L"/business/products/chanpin/" + id.left(2) + L"/" + name;
|
AddImageTerm(row, L"customer-photo", id, path);
|
/*xstring picname = xitem.selectSingleNode(L"PicPath").text();
|
if(picname == L"/business/products/Thumbs//")
|
picname = L"/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg";
|
im.AddImages(picname,goodsno);*/
|
if (ip == 0)
|
{
|
//xstring appPath = GetModuleTmpPath();
|
//xaserver::CreateDirectory(appPath);
|
//xaserver::DownLoadFile(GetServerUrl(),path,name,appPath+L"/"+name);
|
|
int startRow = getItemHeadRow(dw_cell);
|
if (startRow > 1)
|
{
|
int colPhoto = getItemCol(dw_cell, startRow, L"Photo,Customer Photo");
|
xstring props = dw_cell.GetCellProps(row, colPhoto);
|
props = L"<cellprop><edit edittype='image'/></cellprop>";
|
dw_cell.SetCellProps(row, colPhoto, props);
|
//dw_cell.SetItemString(row,colPhoto,appPath+L"\\"+name);
|
dw_cell.SetItemString(row, colPhoto, path);
|
}
|
}
|
}
|
}
|
return 1;
|
}
|
|
int ProcessItemImage1(xstring goodsno, int row)
|
{
|
xml xp ;
|
xaserverarg arg_pic ;
|
|
arg_pic.AddArg(L"GoodsNo", goodsno);
|
|
ximageview im = GetControl(L"frame:im1");
|
im.Reset();
|
xstring res = L"/sale/data/ProductLibrary3/pref/picture/imagelistItemNo";
|
if (xurl::get(res, arg_pic.GetString(), xp) != 1)
|
{
|
trace(xp.xml());
|
return 1;
|
}
|
else
|
{
|
ClearImageTerm(row, L"customer-photo");
|
//alert(xp.xml());
|
KXMLDOMNodeList nlistp = xp.selectNodes(L"ImageList/image");
|
int lenp = nlistp.length();
|
int ip = 0;
|
for (ip = 0; ip < lenp; ip++)
|
{
|
KXMLDOMNode xitem = nlistp.item(ip);
|
xstring id = xitem.selectSingleNode(L"@guid").text();
|
xstring name = id + L".jpg";
|
AddImageTerm(row, L"customer-photo", id);
|
/*xstring picname = xitem.selectSingleNode(L"PicPath").text();
|
if(picname == L"/business/products/Thumbs//")
|
picname = L"/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg";
|
im.AddImages(picname,goodsno);*/
|
if (ip == 0)
|
{
|
xstring appPath = xutil::GetModuleTmpPath();
|
xaserver::CreateDirectory(appPath);
|
xaserver::DownLoadFile(GetServerUrl(), L"/business/products/chanpin/" + id.left(2) + L"/" + name, name, appPath + L"/" + name);
|
|
int startRow = getItemHeadRow(dw_cell);
|
if (startRow > 1)
|
{
|
int colPhoto = getItemCol(dw_cell, startRow, L"Photo,Customer Photo");
|
xstring props = dw_cell.GetCellProps(row, colPhoto);
|
props = L"<cellprop><edit edittype='image'/></cellprop>";
|
dw_cell.SetCellProps(row, colPhoto, props);
|
dw_cell.SetItemString(row, colPhoto, appPath + L"\\" + name);
|
}
|
}
|
}
|
}
|
return 1;
|
}
|
|
int OnAddBOMItem()
|
{
|
int startRow = getItemHeadRow(dw_cell);
|
int headrow = startRow;
|
if (startRow < 1) return 1;
|
startRow++;
|
int row = dw_cell.GetRow();
|
|
int colPurchPrice1 = getItemCol(dw_cell, headrow, L"¼Û¸ñ1");
|
int colPurchPrice2 = getItemCol(dw_cell, headrow, L"¼Û¸ñ2");
|
int colPurchPrice3 = getItemCol(dw_cell, headrow, L"¼Û¸ñ3");
|
if (colPurchPrice3 > 0) return 1;
|
|
if (colPurchPrice2 < 1)
|
{
|
//dw_cell.SetColumnCount(dw_cell.GetColumnCount()+3);
|
//dw_cell.SetColumnCount(dw_cell.GetValidCol()+3);
|
dw_cell.SetRowColumn(row, colPurchPrice1 + 1);
|
dw_cell.SetAnchorRowColumn(row, colPurchPrice1 + 1);
|
|
SendCtrlCmd(dw_cell, L"xmFormatCellInsertCol");
|
SendCtrlCmd(dw_cell, L"xmFormatCellInsertCol");
|
SendCtrlCmd(dw_cell, L"xmFormatCellInsertCol");
|
|
dw_cell.SetItemString(headrow, colPurchPrice1 + 1, L"¹©Ó¦ÉÌ2");
|
dw_cell.SetItemString(headrow, colPurchPrice1 + 2, L"ÀàÐÍ2");
|
dw_cell.SetItemString(headrow, colPurchPrice1 + 3, L"¼Û¸ñ2");
|
}
|
else
|
{
|
//dw_cell.SetColumnCount(dw_cell.GetColumnCount()+3);
|
//dw_cell.SetColumnCount(dw_cell.GetValidCol()+3);
|
dw_cell.SetRowColumn(row, colPurchPrice2 + 1);
|
dw_cell.SetAnchorRowColumn(row, colPurchPrice2 + 1);
|
|
SendCtrlCmd(dw_cell, L"xmFormatCellInsertCol");
|
SendCtrlCmd(dw_cell, L"xmFormatCellInsertCol");
|
SendCtrlCmd(dw_cell, L"xmFormatCellInsertCol");
|
|
dw_cell.SetItemString(headrow, colPurchPrice2 + 1, L"¹©Ó¦ÉÌ3");
|
dw_cell.SetItemString(headrow, colPurchPrice2 + 2, L"ÀàÐÍ3");
|
dw_cell.SetItemString(headrow, colPurchPrice2 + 3, L"¼Û¸ñ3");
|
}
|
return 1;
|
}
|
|
//ÃüÁî·¢²¼º¯Êý
|
int OnCmdDispatch(xstring comdid)
|
{
|
if (comdid == L"xmAddBOMItem") return OnAddBOMItem();
|
if (comdid == L"xmQuoteBill")
|
{
|
if (dw_base.GetItemString(1, L"CustomerID") == L"")
|
{
|
alert(L"µ¼³öǰÇëÊäÈë¿Í»§");
|
return 1;
|
}
|
return OnPrint();
|
}
|
if (comdid == L"tab_quote")
|
{
|
tabsheet = L"tab_quote";
|
return OnToQuote();
|
}
|
if (comdid == L"xmMySupplier")
|
return OnMySupplier();
|
if (comdid == L"xmImageAdd")
|
{
|
OnImageAdd();
|
return 1;
|
}
|
if (comdid == L"xmImageAddEx")
|
{
|
OnImageAddEx();
|
return 1;
|
}
|
if (comdid == L"xmImageDel")
|
{
|
OnImageDel();
|
return 1;
|
}
|
else if (comdid == L"xmPurched")
|
{
|
//if(makeMessage(L"/task/quote/purchar/backtosaler")==-1) return 1;
|
//dw_cell.SetRowColumn(dw_cell.GetRow(), dw_cell.GetColumn());
|
return OnSaleBack();
|
}
|
else if (comdid == L"xmPurch2")
|
{
|
return OnPurch2();
|
}
|
else if (comdid == L"xmPurch")
|
{
|
return OnPurch();
|
}
|
else if (comdid == L"xmSetPurchor")
|
{
|
return OnNextPurch();
|
}
|
else if (comdid == L"xmSetPurchor")
|
{
|
return OnPurchEx();
|
}
|
else if (comdid == L"xmRefreshTask1")
|
{
|
PostMessage(GetFrameWindow().GetHWND(), 0x401, (WPARAM)L"xmRefreshTask", 0);
|
return 1;
|
}
|
else if (comdid == L"xmFileOpen" || comdid == L"xmOpen" || comdid == L"xmNew")
|
{
|
xstring suserid = publiccode::GetUser().id;
|
xaserverarg args ;
|
|
if (comdid == L"xmNew")
|
OpenWindow(L"dev:xpage[TONewSelectDlg.vx]", args);
|
else
|
OpenWindow(L"dev:xpage[TOSelectDlg.vx]", args);
|
fileid = args.GetArgString(L"id");
|
templateID = args.GetArgString(L"templateID");
|
xstring myaction = args.GetArgString(L"action");
|
if (myaction == L"new" && action == L"new") Reset();
|
if (myaction == L"new")
|
{
|
action = L"new";
|
trace(args.GetArgString(L"id"));
|
return OpenTemplate(args.GetArgString(L"id"));
|
}
|
else if (myaction == L"open")
|
{
|
action = L"open";
|
entityID = args.GetArgString(L"ID");
|
entityItemID = args.GetArgString(L"ItemID");
|
|
OnRetrieve(entityID);
|
return OpenDocument(entityItemID);
|
}
|
|
return 1;
|
|
args.AddArg(L"src", L"data/QuoteFile/" + suserid);
|
args.AddArg(L"process", L"path");
|
OpenWindow(L"dev:xpage[trade.document.selectdlg.vx]", args);
|
if (args.GetArgString(L"result") == L"ok")
|
{
|
xstring u = args.GetArgString(L"src");
|
xml x ;
|
|
xaserver::LoadUrl(GetServerUrl(), u, L"", x);
|
trace(x.xml());
|
dw_cell.LoadTemplateEx(x.documentElement());
|
dw_cell.Redraw();
|
filename = args.GetArgString(L"filename");
|
fileid = args.GetArgString(L"ID");
|
SetWindowText(GetHWND(), L"±¨¼ÛÎļþ:" + filename);
|
}
|
return 1;
|
}
|
else if (comdid == L"xmFileNew" || comdid == L"xmNew")
|
{
|
dw_cell.openUrl(templateurl);
|
dw_cell.Redraw();
|
filename = L"";
|
fileid = L"";
|
SetWindowText(GetHWND(), L"±¨¼ÛÎļþ:[new]");
|
return 1;
|
}
|
else if (comdid == L"xmFileSave" || comdid == L"xmSave")
|
{
|
|
return OnSave();
|
}
|
else if (comdid == L"xmSaveEx")
|
{
|
return OnSaveEx();
|
}
|
else if (comdid == L"xmFileSaveAs" || comdid == L"xmSaveAs")
|
{
|
return OnSave(/*saveas*/true);
|
}
|
else if (comdid.left(3) == L"IK_")
|
{
|
int row = dw_cell.GetRow();
|
xstring cmd = comdid.mid(3, comdid.length());
|
if (comdid == L"IK_xmFormatCellDeleteRow" && row > 0)
|
{
|
xstring rowid = getRowID(dw_cell, row);
|
if (rowid != L"")
|
{
|
int frow = LookupRow(rowid);
|
if (frow > 0) dw_goods.DeleteRow(frow);
|
}
|
}
|
SendCtrlCmd(dw_cell, cmd);
|
if (comdid == L"IK_xmEditCut"|| comdid == L"IK_xmEditCut")ReCalcPOPrice();
|
return 1;
|
}
|
else if (comdid == L"xmFormatCellDeleteRow")
|
{
|
if (action == L"purch")
|
{
|
int crow = dw_cell.GetRow();
|
if (getRowID(dw_cell, crow) == L"") SendCtrlCmd(dw_cell, comdid);
|
return 1;
|
}
|
return 1;
|
}
|
return 0;
|
}
|
|
xstring GetNo()
|
{
|
xstring typ = L"C";
|
|
xml x ;
|
|
xaserverarg arg ;
|
|
arg.AddArg(L"count", L"1");
|
arg.AddArg(L"type", typ);
|
if (xurl::get(L"/sale/data/SO/goods/usegoods/goodslib/asknos", arg.GetString(), x) != 1)return L"";
|
return x.text();
|
}
|
|
int OnSaveNewItem(xstring content)
|
{
|
xml x ;
|
|
xaserverarg arg ;
|
|
arg.AddArg(L"content", content);
|
if (xurl::get(L"/sale/data/ProductLibrary3/update/newestproduct", arg.GetString(), x) != 1)
|
{
|
xstring error = x.text();
|
alert(error);
|
return -1;
|
}
|
return 1;
|
}
|
|
int OnPurch2()
|
{
|
xaserverarg arg;
|
arg.AddArg(L"EntityID", entityID);
|
OpenWindow(L"dev:xpage[QuoteFilePurch2Select.vx]", arg);
|
xstring taskID = arg.GetArgString(L"TaskID");
|
xstring reason = arg.GetArgString(L"Reason");
|
if (taskID != L"")
|
{
|
ProcessSendMessage(L"/task/quote/repurch", taskID, reason, L"", true);
|
}
|
return 1;
|
}
|
|
int OnSaveEx(bool balert = false)
|
{
|
//dw_cell.AcceptText();
|
|
OnToQuote();
|
if (dw_base.GetItemString(1, L"SalespersonID") == L"")OnInit();
|
|
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);
|
setBaseItem(dw_cell, L"±¨¼Ûµ¥ºÅ:", QuoteNo);
|
}
|
if (dw_base.GetGuid(1) == L"")
|
dw_base.SetGuid(1, entityID);
|
|
xml x1 ;
|
bool hasNew = false;
|
|
xstring sdate = publiccode::GetCurrentDate();
|
xstring suserid = publiccode::GetUser().id;
|
xstring categoryID = L"EF37E57D-5833-4AF9-BA5E-01CCF39C1F20";
|
xstring folderID = L"10200009-0000-0000-0001-000000000000";
|
|
for (int i = 1; i <= dw_goods.GetRowCount(); i++)
|
{
|
if (dw_goods.GetItemString(i, L"ItemID") == L"" || dw_goods.GetItemString(i, L"SKUNo") == L"")
|
{
|
//alert(L"row:"+xstring(i));
|
hasNew = true;
|
xstring ItemID = GetGuid();
|
dw_goods.SetItemString(i, L"ItemID", ItemID);
|
xstring Item = L"<Item update.new='1' update.modify='1' guid='" + ItemID + L"'>";
|
Item += L"<SKUID>" + ItemID + L"</SKUID>";
|
Item += L"<GoodsNo>" + dw_goods.GetItemString(i, L"GoodsNo") + L"</GoodsNo>";
|
xstring SKUNo = GetNo();
|
dw_goods.SetItemString(i, L"SKUNo", SKUNo);
|
dw_goods.Redraw();
|
|
int frow = LookupCellRow(dw_goods.GetGuid(i));
|
//alert(dw_goods.GetGuid(1)+L"--"+xstring(frow));
|
if (frow > 0) dw_cell.SetItemString(frow, 1, SKUNo);
|
|
Item += L"<No>" + SKUNo + L"</No>";
|
Item += L"<SKUNo>" + SKUNo + L"</SKUNo>";
|
Item += L"<CName>" + dw_goods.GetItemString(i, L"CName") + L"</CName>";
|
Item += L"<EName>" + dw_goods.GetItemString(i, L"ItemName") + L"</EName>";
|
Item += L"<Packing>" + dw_goods.GetItemString(i, L"Packing") + L"</Packing>";
|
|
Item += L"<CategoryID>" + categoryID + L"</CategoryID>";
|
Item += L"<FolderID>" + folderID + L"</FolderID>";
|
|
Item += L"<CreateID>" + suserid + L"</CreateID>";
|
Item += L"<CreateDate>" + sdate + L"</CreateDate>";
|
Item += L"<ModifierID>" + suserid + L"</ModifierID>";
|
Item += L"<ModifyDate>" + sdate + L"</ModifyDate>";
|
|
Item += L"</Item>";
|
|
if (hasNew)
|
{
|
xstring newItem = L"<data>" + Item + L"</data>";
|
trace(newItem);
|
if (OnSaveNewItem(newItem) == -1) return 1;
|
}
|
}
|
}
|
|
xml x ;
|
|
xaserverarg arg ;
|
|
dw_goods.DwUpdateAllToEx(x);
|
dw_base.DwUpdateAllTo(x);
|
|
xstring error = L"";
|
arg.AddArg(L"content", x.xml());
|
|
//trace(x.xml());
|
//return 1;
|
|
if (xurl::get(L"/sale/data/Quote/update", arg.GetString(), x) != 1)
|
{
|
error = x.text();
|
alert(error);
|
}
|
else
|
{
|
xstring str = x.documentElement().getAttribute(L"text");
|
if (str == L"true")
|
{
|
dw_goods.ResetUpdateStatus();
|
dw_base.ResetUpdateStatus();
|
if (balert)alert(L"±£´æ³É¹¦!");
|
|
return -1;
|
|
}
|
else
|
{
|
alert(L"±£´æÊ§°Ü!");
|
return -1;
|
}
|
}
|
return 1;
|
}
|
|
xstring GetExchangeRate(xstring pcur, xstring pdate)
|
{
|
|
if (pcur.toUpper() == L"RMB") return L"1";
|
xstring exchangeRate = L"";
|
if (exchangeRate == L"") {
|
xml x = ViewObject::RetrieveData(L"/sale/data/GDN3/profit/param", L"item", L"cryrate");
|
if (x.selectSingleNode(L"root/item/@value"))
|
exchangeRate = x.selectSingleNode(L"root/item/@value").text();
|
}
|
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.selectSingleNode(L"root/item/@value"))
|
exchangeRate = x.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.documentElement;
|
scguid = sureNodeText(e1,L"CompanyID");
|
sCename = sureNodeText(e1,L"CompanyID/@_displaystring");
|
*/
|
|
return 1;
|
}
|
|
int OnRowChanged(TEvent* evt, LPARAM p)
|
{
|
DWNMHDR& hdr = *(DWNMHDR * )evt->notify.pnmh;
|
int row = hdr.row;
|
|
return OnQuoteLineChanged(row);
|
}
|
|
int OnQuoteLineChanged(int row)
|
{
|
ximageview im = GetControl(L"im1");
|
im.Reset();
|
//xstring skuno = dw_goods.GetItemString(row,L"SKUNo");
|
//OnShowImage(skuno,row);
|
//im.Redraw();
|
|
xstring rowid = dw_goods.GetGuid(row);
|
int frow = LookupCellRow(rowid);
|
if (frow > 0)
|
{
|
xstring str = dw_cell.GetItemString(frow, 0);
|
trace(L"\r\ncustomer-photo:" + str);
|
ShowImageOne(im, str, L"customer-photo");
|
im.Redraw();
|
|
RowChanged(frow);
|
}
|
return 1;
|
}
|
|
int OnShowImage(xstring skuno, int row)
|
{
|
ximageview im = GetControl(L"im1");
|
|
xml xp ;
|
xaserverarg arg_pic ;
|
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 (xurl::get(res, arg_pic.GetString(), xp) != 1)
|
{
|
trace(xp.xml());
|
return 1;
|
}
|
else
|
{
|
KXMLDOMNodeList nlistp = xp.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 (xurl::get(res, arg_pic.GetString(), xp) != 1)
|
{
|
trace(xp.xml());
|
return 1;
|
}
|
else
|
{
|
KXMLDOMNodeList nlistp = xp.selectNodes(L"ImageList/image");
|
long lenp = nlistp.length();
|
for (int ip = 0; ip < lenp; ip++)
|
{
|
KXMLDOMNode 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);
|
}
|
}
|
}
|
return 1;
|
}
|
|
int OnUpdateEntityFile()
|
{
|
xcell cell1 = GetControl(L"dw_cell1");
|
xstring content = cell1.GetData();
|
content = content.mid(content.find(L"<xsheet"), 9999999);
|
while (true)
|
{
|
int pos = content.find(L"<display>");
|
int pos1 = 0;
|
xstring str = L"";
|
if (pos >= 0)
|
{
|
pos1 = content.find(L"</display>", pos);
|
str = content.mid(pos1 + xstring(L"</display>").length(), 9999999);
|
content = content.left(pos) + str;
|
}
|
else
|
break;
|
}
|
int ret = 1;
|
if (content != L"")
|
{
|
ret = ProcessSendMessage(L"/task/quote/file-update", entityID, content, L"", false);
|
}
|
return ret;
|
}
|
|
int OnUpdateProcessed()
|
{
|
int ret = ProcessSendMessage(L"/task/quote/update-processed", taskid, L"", L"", false);
|
PostMessage(GetFrameWindow().GetHWND(), 0x401, (WPARAM)L"xmRefreshTask", 0);
|
return ret;
|
}
|
|
int OnUpdate()
|
{
|
//set rowid
|
ensureRowID();
|
|
xstring content = dw_cell.GetData();
|
content = content.mid(content.find(L"<xsheet"), 9999999);
|
while (true)
|
{
|
int pos = content.find(L"<display>");
|
int pos1 = 0;
|
xstring str = L"";
|
if (pos >= 0)
|
{
|
pos1 = content.find(L"</display>", pos);
|
str = content.mid(pos1 + xstring(L"</display>").length(), 9999999);
|
content = content.left(pos) + str;
|
}
|
else
|
break;
|
}
|
//trace(content);
|
xstring business = L"";
|
//trace(content);
|
|
if (action == L"new")
|
{
|
entityID = ViewObject::GetGuid();
|
entityItemID = ViewObject::GetGuid();
|
}
|
|
//trace(L"\r\nid:"+entityID+L" termid:"+entityItemID);
|
business = L"<business action='" + action + L"' id='" + entityID + L"' itemid='" + entityItemID + L"' processurl='" + processurl + L"' termid='" + templateID + L"'>";
|
business += L"<content>" + content + L"</content></business>";
|
xstring datacontent = GetSaleFullData(dw_cell);
|
bool balter = false;
|
if (action == L"purch")
|
balter = true;
|
|
int ret = ProcessSendMessage(L"/task/quote/update", L"", business, datacontent, balter);
|
//int ret = ProcessSendMessage(L"/task/quote/update", L"", business,false);
|
|
|
|
if (action == L"new" && ret == 1) action = L"open";
|
return ret;
|
}
|
|
int OnSave(bool saveas = false)
|
{
|
//dw_cell.AcceptText();
|
dw_cell.SetRowColumn(1, 1);
|
dw_cell.SetAnchorRowColumn(1, 1);
|
|
if (tabsheet != L"tab_quote") OnToQuote();
|
|
if (getBaseItem(dw_cell, L"±¨¼Ûµ¥ºÅ:") == L"")
|
setBaseItem(dw_cell, L"±¨¼Ûµ¥ºÅ:", dw_base.GetItemString(1, L"QuoteNo"));
|
|
OnUpdate();
|
if (action == L"purch") return 1;
|
return OnSaveEx(true);
|
|
xstring suserid = publiccode::GetUser().id;
|
xstring myurl = L"data/QuoteFile/" + suserid;
|
xstring sfilename = filename;
|
if (filename == L"" || saveas)
|
{
|
xaserverarg arg ;
|
arg.AddArg(L"src", myurl);
|
OpenWindow(L"dev:xpage[trade.document.saveas.vx]", arg);
|
if (arg.GetArgString(L"result") == L"ok")
|
{
|
sfilename = arg.GetArgString(L"filename");
|
}
|
else
|
return 1;
|
}
|
|
xstring content = dw_cell.GetData();
|
|
xstring sguid = publiccode::GetGuid();
|
xstring sname = sguid;
|
xstring str = sname.mid(0, 2);
|
str = str.toUpper();
|
xstring suri = L"attachment" + str;
|
int ret = xaserver::UploadData(suri, sguid + L".jpg", content);
|
if (ret < 0)
|
{
|
alert(L"ÉÏ´«Îļþ³ö´í!");
|
return 0;
|
}
|
|
xml x ;
|
xaserverarg args ;
|
args.AddArg(L"myurl", myurl);
|
args.AddArg(L"name", sfilename);
|
args.AddArg(L"filepath", sname);
|
args.AddArg(L"fileext", L"xdoc");
|
args.AddArg(L"filesource", sfilename);
|
args.AddArg(L"filesource", sfilename);
|
args.AddArg(L"id", fileid);
|
|
xstring path = L"/sale/data/TDocument3/attachment/update";
|
if (filename == L"" || saveas) path = L"/sale/data/TDocument3/attachment/add";
|
if (xurl::get(path, args.GetString(), x) != 1)
|
{
|
alert(L"±£´æ³ö´íÁË!");
|
return 0;
|
}
|
else
|
{
|
filename = sfilename;
|
SetWindowText(GetHWND(), L"±¨¼ÛÎļþ:" + filename);
|
alert(x.text());
|
}
|
|
return 1;
|
}
|
|
int SendCtrlCmd(xcontrol xc, xstring cmd)
|
{
|
SendMessage(xc.GetHWND(), 0x401, (WPARAM)cmd.c_str(), 0);
|
return 1;
|
}
|
|
int OnCellClicked(TEvent* evt, LPARAM p)
|
{
|
DWNMHDR& dwhdr=*(DWNMHDR*)evt->notify.pnmh;
|
int row = dwhdr.row;
|
int col = dwhdr.col;
|
//xstring col = dwhdr.colname;
|
//xstring data = dwhdr.data;
|
|
//alert(xstring(col));
|
int startRow = getItemHeadRow(dw_cell);
|
if (startRow < 1) return 1;
|
|
if (row < startRow)
|
{
|
xstring val = dw_cell.GetItemString(row, col);
|
if (val == L"±¨¼Ûµ¥ºÅ:" || val == L"±¨¼Û½ØÖ¹ÈÕÆÚ£º" || val == L"ÏîÄ¿Ãû³Æ:")
|
{
|
dwhdr.idFrom = -1;
|
return 1;
|
}
|
if (col > 1)
|
{
|
val = dw_cell.GetItemString(row, col - 1);
|
if (val == L"±¨¼Ûµ¥ºÅ:")
|
{
|
dwhdr.idFrom = -1;
|
return 1;
|
}
|
}
|
}
|
if (row == startRow)
|
{
|
dwhdr.idFrom = -1;
|
return 1;
|
}
|
if (row < startRow + 1) return 1;
|
startRow++;
|
|
trace(xstring(row) + L"---" + xstring(startRow - 1));
|
|
int colItemNo = getItemCol(dw_cell, startRow - 1, L"ÎÒ˾ÐͺÅ,ItemNo");
|
int colCustomerItemNo = getItemCol(dw_cell, startRow - 1, L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(dw_cell, startRow - 1, L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(dw_cell, startRow - 1, L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(dw_cell, startRow - 1, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colBuyerPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û,²É¹º¼Û¸ñ");
|
int colBuyer = getItemCol(dw_cell, startRow - 1, L"²É¹ºÈËÔ±");
|
int colCustomerPhoto = getItemCol(dw_cell, startRow - 1, L"Photo,Customer Photo");
|
int colPackage = getItemCol(dw_cell, startRow - 1, L"Package,°ü×°·½Ê½");
|
int colFOBPrice = getItemCol(dw_cell, startRow - 1, L"FOB Price,FOB Price(USD),Fob Price");
|
int colQty = getItemCol(dw_cell, startRow - 1, L"Qty,ÊýÁ¿");
|
//int colToPODate = getItemCol(dw_cell,startRow - 1,L"ÒµÎñ·¢ËͲɹºÊ±¼ä");
|
|
int colSaler = getItemCol(dw_cell, startRow - 1, L"ÒµÎñÔ±");
|
|
int colVolDesc = getItemCol(dw_cell, startRow - 1, L"Ìå»ýÃèÊö,³¤X¿íX¸ß,³¤X¿íX¸ß(CM)");
|
int colVol = getItemCol(dw_cell, startRow - 1, L"Ìå»ý,Ìå»ý(M3)");
|
int colQtyPerPack = getItemCol(dw_cell, startRow - 1, L"×°ÏäÊý(ÄÚ/Íâ),×°ÏäÊý(Íâ/ÄÚ)");
|
int col40HQ = getItemCol(dw_cell, startRow - 1, L"40HQ,QTY(40HQ)");
|
int colSKUID = getItemCol(dw_cell, startRow - 1, L"SKUID");
|
|
int colPONote = getItemCol(dw_cell, startRow - 1, L"²É¹ºToÒµÎñ±¸×¢");
|
int colPONote2 = getItemCol(dw_cell, startRow - 1, L"ÒµÎñTo²É¹º±¸×¢");
|
|
int colItemNote = getItemCol(dw_cell, startRow - 1, L"²úÆ·±¸×¢");
|
|
int colPOPhoto = getItemCol(dw_cell, startRow - 1, L"¹¤³§Í¼Æ¬");
|
int colPOPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û");
|
int colNW = getItemCol(dw_cell, startRow - 1, L"Ã«ÖØ(KG)");
|
int colGW = getItemCol(dw_cell, startRow - 1, L"¾»ÖØ(KG)");
|
int colSKUNo = getItemCol(dw_cell, startRow - 1, L"SKUID,SKUNo");
|
|
int purchremarkcol = getItemCol(dw_cell, startRow - 1, L"²É¹ºToÒµÎñ±¸×¢");
|
int colRemark = getItemCol(dw_cell, startRow - 1, L"Remarks");
|
|
//int colProductInfo = getItemCol(dw_cell,startRow - 1,L"²úÆ·ÐÅÏ¢");
|
int colProductInfo = getItemCol(dw_cell, startRow - 1, L"ÒµÎñ²¿²úÆ·ÐÅÏ¢");
|
int colProductInfo1 = getItemCol(dw_cell, startRow - 1, L"²É¹º²¿²úÆ·ÐÅÏ¢");
|
|
|
int colItemPurchDate = getItemCol(dw_cell, startRow - 1, L"ÒµÎñ·¢ËͲɹºÊ±¼ä");
|
|
dwhdr.idFrom = 0;
|
if (action != L"purch")
|
{
|
if (col == colPONote || col == colProductInfo1 || col == colItemNote || col == colPOPhoto || col == colPOPrice || col == colNW || col == colGW || col == colVol || col == colVolDesc)
|
{
|
dwhdr.idFrom = -1;
|
return 1;
|
}
|
/*if(col==colProductInfo && dw_cell.GetItemString(row,colItemPurchDate)!=L"")
|
{
|
dwhdr.idFrom = -1;
|
return 1;
|
}*/
|
}
|
|
if (action != L"purched")
|
{
|
if (col == colBuyer)
|
{
|
KXMLDOMNodeList items = purcher.selectNodes(L"//HrEmployee");
|
int count = items.length();
|
xstring pitems = L"";
|
for (int i = 0; i < count; i++)
|
{
|
pitems += (xstring)L"<row><ÏÔʾÁÐ>" + items.item(i).selectSingleNode(L"Name").text() + L"</ÏÔʾÁÐ><Êý¾ÝÁÐ>"
|
+ items.item(i).selectSingleNode(L"Name").text() + L"</Êý¾ÝÁÐ></row>";
|
|
}
|
xstring prop = (xstring)L"<cellprop searchcolumn='' celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='' cellvisibleex='' cellvisible='' cellneeddata='' cellvalid='' cellinitial='' cellsource='' fontstyle='' windowurl=''>" +
|
L"<edit edittype='ddlb' ddlbdataurl='' ddlbxml='<data>" + pitems + L"</data>'/>" +
|
L"</cellprop>";
|
dw_cell.SetCellProps(row, col, prop);
|
}
|
}
|
|
if (action != L"purch" && action != L"purched")
|
{
|
/*if(col ==colBuyer)
|
{
|
KXMLDOMNodeList items = purcher.selectNodes(L"//HrEmployee");
|
int count = items.length();
|
xstring pitems = L"";
|
for(int i=0;i<count;i++)
|
{
|
pitems += L"<row><ÏÔʾÁÐ>"+items.item(i).selectSingleNode(L"Name").text+L"</ÏÔʾÁÐ><Êý¾ÝÁÐ>"
|
+items.item(i).selectSingleNode(L"Name").text + L"</Êý¾ÝÁÐ></row>";
|
|
}
|
xstring prop=L"<cellprop searchcolumn='' celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='' cellvisibleex='' cellvisible='' cellneeddata='' cellvalid='' cellinitial='' cellsource='' fontstyle='' windowurl=''>" +
|
"<edit edittype='ddlb' ddlbdataurl='' ddlbxml='<data>" + pitems + L"</data>'/>" +
|
"</cellprop>";
|
dw_cell.SetCellProps(row,col,prop);
|
}*/
|
if (col == colPackage)
|
{
|
xstring proppack = L"<cellprop searchcolumn='' celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='±£»¤' cellvisibleex='' cellvisible='' cellneeddata='' cellvalid='' cellinitial='' cellsource='' fontstyle='' windowurl=''><edit edittype='ddlb' ddlbdataurl='xquery:[Convert.quickcode.xq]?id=°ü×°·½Ê½1' ddlbxml=''/></cellprop>";
|
dw_cell.SetCellProps(row, col, proppack);
|
}
|
}
|
|
|
//alert(action);
|
if (action == L"purch")
|
{
|
if (col == colPONote2 || col == colProductInfo || col == colCustomerPhoto || col == colSaler || col == colSKUID || col == colQty || col == colBuyerPrice || col == col40HQ || col == colQtyPerPack || col == colPackage || col == colItemNo || col == colItemCName || col == colCustomerItemNo || col == colItemName || col == colItemSpec //|| colBuyer ==col
|
|| col == colVol)
|
{
|
dwhdr.idFrom = -1;
|
return 1;
|
}
|
}
|
|
if (action == L"purch")
|
{
|
int colPrice0 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ");
|
int colPrice1 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ1");
|
int colPrice2 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ2");
|
int colPrice3 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ3");
|
int colPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û");
|
|
int colTyp = getItemCol(dw_cell, startRow - 1, L"ÀàÐÍ");
|
int colTyp1 = getItemCol(dw_cell, startRow - 1, L"ÀàÐÍ1");
|
int colTyp2 = getItemCol(dw_cell, startRow - 1, L"ÀàÐÍ2");
|
int colTyp3 = getItemCol(dw_cell, startRow - 1, L"ÀàÐÍ3");
|
int colSupplier = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ,¹¤³§");
|
int colSupplier1 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ1,¹¤³§1");
|
int colSupplier2 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ2,¹¤³§2");
|
int colSupplier3 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ3,¹¤³§3");
|
|
|
if (col == colSupplier || col == colSupplier1 || col == colSupplier2 || col == colSupplier3)
|
{
|
if (dw_cell.GetItemString(row, col) == L"")
|
dw_cell.SetItemString(row, col, L" ");
|
xstring prop2 = (xstring)L"<cellprop searchcolumn='' celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='' cellvisibleex='' cellvisible='' cellneeddata='' cellvalid='' cellinitial='' cellsource='' fontstyle='' windowurl=''>" +
|
L"<edit edittype='query' dddwxpageurl='' dddwdataurl='xquery:[Convert.quickcode.xq]?id=Supplier' dddwtemplateurl='dev:sheet[Supplier.v3.tpl/List]' dddwdatacolumn='Name' dddwdisplaycolumn='Name' dddwwidth='' dddwheight='' dddwautoselect='N' dddwshowbutton='·ñ' dddwcanedit='ÊÇ'/>" +
|
L"</cellprop>";
|
dw_cell.SetCellProps(row, col, prop2);
|
dw_cell.Redraw();
|
}
|
else if (col == colTyp1 || col == colTyp || col == colTyp2 || col == colTyp3)
|
{
|
xstring pitems1 = L"";
|
pitems1 += (xstring)L"<row><ÏÔʾÁÐ></ÏÔʾÁÐ><Êý¾ÝÁÐ>"
|
+ L"</Êý¾ÝÁÐ></row>";
|
pitems1 += (xstring)L"<row><ÏÔʾÁÐ>³ÉÆ·</ÏÔʾÁÐ><Êý¾ÝÁÐ>"
|
+ L"³ÉÆ·</Êý¾ÝÁÐ></row>";
|
pitems1 += (xstring)L"<row><ÏÔʾÁÐ>É¢»õ</ÏÔʾÁÐ><Êý¾ÝÁÐ>"
|
+ L"É¢»õ</Êý¾ÝÁÐ></row>";
|
pitems1 += (xstring)L"<row><ÏÔʾÁÐ>°ü×°</ÏÔʾÁÐ><Êý¾ÝÁÐ>"
|
+ L"°ü×°</Êý¾ÝÁÐ></row>";
|
xstring prop1 = (xstring)L"<cellprop searchcolumn='' celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='' cellvisibleex='' cellvisible='' cellneeddata='' cellvalid='' cellinitial='' cellsource='' fontstyle='' windowurl=''>" +
|
L"<edit edittype='ddlb' ddlbdataurl='' ddlbxml='<data>" + pitems1 + L"</data>'/>" +
|
L"</cellprop>";
|
dw_cell.SetCellProps(row, col, prop1);
|
}
|
}
|
if (ARow != row) RowChanged(row);
|
ARow = row;
|
ACol = col;
|
//orivalue = dw_cell.GetItemString(ARow,ACol);
|
|
return 1;
|
}
|
|
|
int OnCellClicked1(TEvent* evt, LPARAM p)
|
{
|
DWNMHDR dwhdr = *(DWNMHDR*)evt->notify.pnmh;
|
int row = dwhdr.row;
|
int col = dwhdr.col;
|
//xstring col = dwhdr.colname;
|
//xstring data = dwhdr.data;
|
|
//alert(xstring(col));
|
int startRow = getItemHeadRow(dw_cell);
|
if (startRow < 1) return 1;
|
if (row == startRow)
|
{
|
dwhdr.idFrom = -1;
|
return 1;
|
}
|
if (row < startRow + 1) return 1;
|
startRow++;
|
|
trace(xstring(row) + L"---" + xstring(startRow - 1));
|
|
int colItemNo = getItemCol(dw_cell, startRow - 1, L"ÎÒ˾ÐͺÅ,ItemNo");
|
int colCustomerItemNo = getItemCol(dw_cell, startRow - 1, L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(dw_cell, startRow - 1, L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(dw_cell, startRow - 1, L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(dw_cell, startRow - 1, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colBuyerPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û,²É¹º¼Û¸ñ");
|
int colBuyer = getItemCol(dw_cell, startRow - 1, L"²É¹ºÈËÔ±");
|
int colCustomerPhoto = getItemCol(dw_cell, startRow - 1, L"Photo,Customer Photo");
|
int colPackage = getItemCol(dw_cell, startRow - 1, L"Package,°ü×°·½Ê½");
|
int colFOBPrice = getItemCol(dw_cell, startRow - 1, L"FOB Price,FOB Price(USD),Fob Price");
|
int colQty = getItemCol(dw_cell, startRow - 1, L"Qty,ÊýÁ¿");
|
//int colToPODate = getItemCol(dw_cell,startRow - 1,L"ÒµÎñ·¢ËͲɹºÊ±¼ä");
|
|
|
int colVolDesc = getItemCol(dw_cell, startRow - 1, L"Ìå»ýÃèÊö,³¤X¿íX¸ß,³¤X¿íX¸ß(CM)");
|
int colVol = getItemCol(dw_cell, startRow - 1, L"Ìå»ý,Ìå»ý(M3)");
|
int colQtyPerPack = getItemCol(dw_cell, startRow - 1, L"×°ÏäÊý(ÄÚ/Íâ),×°ÏäÊý(Íâ/ÄÚ)");
|
int col40HQ = getItemCol(dw_cell, startRow - 1, L"40HQ,QTY(40HQ)");
|
int colSKUID = getItemCol(dw_cell, startRow - 1, L"SKUID");
|
|
int colPONote = getItemCol(dw_cell, startRow - 1, L"²É¹ºToÒµÎñ±¸×¢");
|
int colPOPhoto = getItemCol(dw_cell, startRow - 1, L"¹¤³§Í¼Æ¬");
|
int colPOPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û");
|
int colNW = getItemCol(dw_cell, startRow - 1, L"Ã«ÖØ(KG)");
|
int colGW = getItemCol(dw_cell, startRow - 1, L"¾»ÖØ(KG)");
|
int colSKUNo = getItemCol(dw_cell, startRow - 1, L"SKUID,SKUNo");
|
|
dwhdr.idFrom = 0;
|
if (action != L"purch")
|
{
|
if (col == colPONote || col == colPOPhoto || col == colPOPrice || col == colNW || col == colGW || col == colVol || col == colVolDesc)
|
{
|
dwhdr.idFrom = -1;
|
return 1;
|
}
|
}
|
|
if (ACol == colFOBPrice && (col != colFOBPrice || row != ARow) && ARow >= startRow)
|
{
|
xstring fobprice = dw_cell.GetItemString(ARow, ACol);
|
if (fobprice.left(1) != L"$") dw_cell.SetItemString(ARow, ACol, L"$" + fobprice);
|
}
|
|
if (action != L"purch" && action != L"purched")
|
{
|
if (col == colBuyer)
|
{
|
KXMLDOMNodeList items = purcher.selectNodes(L"//HrEmployee");
|
int count = items.length();
|
xstring pitems = L"";
|
for (int i = 0; i < count; i++)
|
{
|
pitems += (xstring)L"<row><ÏÔʾÁÐ>" + items.item(i).selectSingleNode(L"Name").text() + L"</ÏÔʾÁÐ><Êý¾ÝÁÐ>"
|
+ items.item(i).selectSingleNode(L"Name").text() + L"</Êý¾ÝÁÐ></row>";
|
|
}
|
xstring prop = (xstring)L"<cellprop searchcolumn='' celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='' cellvisibleex='' cellvisible='' cellneeddata='' cellvalid='' cellinitial='' cellsource='' fontstyle='' windowurl=''>" +
|
L"<edit edittype='ddlb' ddlbdataurl='' ddlbxml='<data>" + pitems + L"</data>'/>" +
|
L"</cellprop>";
|
dw_cell.SetCellProps(row, col, prop);
|
}
|
if (col == colPackage)
|
{
|
xstring proppack = L"<cellprop searchcolumn='' celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='±£»¤' cellvisibleex='' cellvisible='' cellneeddata='' cellvalid='' cellinitial='' cellsource='' fontstyle='' windowurl=''><edit edittype='ddlb' ddlbdataurl='xquery:[Convert.quickcode.xq]?id=°ü×°·½Ê½1' ddlbxml=''/></cellprop>";
|
dw_cell.SetCellProps(row, col, proppack);
|
}
|
}
|
|
if (ACol == colItemNo && col != colItemNo && dw_cell.GetItemString(ARow, colItemNo) != orivalue)
|
{
|
trace(L"/r/n--------------------");
|
if (dw_cell.GetItemString(ARow, colItemNo) != L"")
|
{
|
xaserverarg argx ;
|
|
argx.AddArg(L"GoodsNo", dw_cell.GetItemString(ARow, colItemNo));
|
OpenWindow(L"dev:xpage[CustomerItemNoList.vx]", argx);
|
if (argx.GetArgString(L"action") != L"ok")
|
{
|
ARow = row;
|
ACol = col;
|
orivalue = dw_cell.GetItemString(row, col);
|
return 1;
|
}
|
|
xml x1 ;
|
|
x1.loadXML(argx.GetArgString(L"items"));
|
if (x1.selectSingleNode(L"//CustomerItemNo"))
|
{
|
xstring CustomerItemNo = x1.selectSingleNode(L"//CustomerItemNo").text();
|
dw_cell.SetItemString(ARow, colCustomerItemNo, CustomerItemNo);
|
}
|
|
xml goods = GetProduct(dw_cell.GetItemString(ARow, colItemNo));
|
|
if (goods)
|
{
|
dw_cell.SetItemString(ARow, colCustomerPhoto, L"");
|
resetRowTerm(dw_cell, ARow, L"customer-photo");
|
if (goods.selectSingleNode(L"//SKUID[1]"))
|
{
|
setRowProp(dw_cell, ARow, L"SKUID", goods.selectSingleNode(L"//SKUID[1]").text());
|
}
|
if (goods.selectSingleNode(L"//SKUNo[1]"))
|
{
|
dw_cell.SetItemString(ARow, colSKUNo, goods.selectSingleNode(L"//SKUNo[1]").text());
|
}
|
if (goods.selectSingleNode(L"//EName[1]"))
|
dw_cell.SetItemString(ARow, colItemName, goods.selectSingleNode(L"//EName[1]").text());
|
if (goods.selectSingleNode(L"//CName[1]"))
|
dw_cell.SetItemString(ARow, colItemCName, goods.selectSingleNode(L"//CName[1]").text());
|
if (goods.selectSingleNode(L"//Packing[1]"))
|
dw_cell.SetItemString(ARow, colPackage, goods.selectSingleNode(L"//Packing[1]").text());
|
if (goods.selectSingleNode(L"//POCreatorID[1]"))
|
{
|
dw_cell.SetItemString(ARow, colBuyer, goods.selectSingleNode(L"//POCreatorID[1]").text());
|
}
|
if (goods.selectSingleNode(L"//PackingRate[1]"))
|
{
|
if (goods.selectSingleNode(L"//InnerQty[1]"))
|
{
|
xstring str1 = goods.selectSingleNode(L"//PackingRate[1]").text();
|
xstring str2 = goods.selectSingleNode(L"//InnerQty[1]").text();
|
dw_cell.SetItemString(ARow, colQtyPerPack, str2 + L"/" + str1);
|
}
|
else
|
{
|
xstring str1 = goods.selectSingleNode(L"//PackingRate[1]").text();
|
dw_cell.SetItemString(ARow, colQtyPerPack, str1);
|
}
|
}
|
ProcessItemImage(dw_cell.GetItemString(ARow, colSKUNo), ARow);
|
//ProcessItemImage1(dw_cell.GetItemString(ARow,colItemNo),ARow);
|
dw_cell.SetRowColumn(row, col);
|
dw_cell.SetAnchorRowColumn(row, col);
|
}
|
}
|
}
|
|
if (((ACol == colVolDesc && (col != colVolDesc || row != ARow)) || (ACol == colQtyPerPack && (col != colQtyPerPack || row != ARow))) && ARow >= startRow)
|
{
|
/*¼ÆËãÌå»ý*/
|
xstring desc = dw_cell.GetItemString(ARow, colVolDesc);
|
double v = 0.0;
|
if (desc == L"")
|
dw_cell.SetItemString(ARow, colVol, L"");
|
else
|
{
|
v = calcVol(desc) / 1000000.00;
|
xstring str = xstring(v);
|
if (str.find(L".") >= 0) str = str.left(str.find(L".") + 5);
|
dw_cell.SetItemString(ARow, colVol, str);
|
dw_cell.Redraw();
|
}
|
|
xstring qtyperPack = dw_cell.GetItemString(ARow, colQtyPerPack);
|
if (qtyperPack != L"")
|
{
|
xstring qty1 = qtyperPack;
|
xstring qty2 = L"";
|
double qty = 0.00;
|
int pos2 = qtyperPack.find(L"/");
|
if (pos2 >= 0)
|
{
|
qty1 = qtyperPack.left(qtyperPack.find(L"/"));
|
qty2 = qtyperPack.mid(qtyperPack.find(L"/") + 1, 9999);
|
}
|
if (qty1 != L"") qty = qty1.toDouble();
|
if (qty2 != L"") qty = qty * qty2.toDouble();
|
double ttl = 65.0 * qty / v;
|
dw_cell.SetItemString(ARow, col40HQ, xstring((int)ttl));
|
}
|
}
|
|
//alert(action);
|
if (action == L"purch")
|
{
|
if (col == colSKUID || col == colQty || col == colBuyerPrice || col == col40HQ || col == colQtyPerPack || col == colPackage || col == colItemNo || col == colItemCName || col == colCustomerItemNo || col == colItemName || col == colItemSpec || colBuyer == col
|
|| col == colVol)
|
{
|
dwhdr.idFrom = -1;
|
return 1;
|
}
|
}
|
|
if (action == L"purch")
|
{
|
int colPrice0 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ");
|
int colPrice1 = getItemCol(dw_cell, startRow - 1, L"¼Û¸ñ1");
|
int colPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û");
|
|
int colTyp = getItemCol(dw_cell, startRow - 1, L"ÀàÐÍ");
|
int colTyp1 = getItemCol(dw_cell, startRow - 1, L"ÀàÐÍ1");
|
int colSupplier = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ,¹¤³§");
|
int colSupplier1 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ1,¹¤³§1");
|
int colSupplier2 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ2,¹¤³§2");
|
|
|
if (col == colSupplier || col == colSupplier1 || col == colSupplier2)
|
{
|
if (dw_cell.GetItemString(row, col) == L"")
|
dw_cell.SetItemString(row, col, L" ");
|
xstring prop2 = (xstring)L"<cellprop searchcolumn='' celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='' cellvisibleex='' cellvisible='' cellneeddata='' cellvalid='' cellinitial='' cellsource='' fontstyle='' windowurl=''>" +
|
L"<edit edittype='query' dddwxpageurl='' dddwdataurl='xquery:[Convert.quickcode.xq]?id=Supplier' dddwtemplateurl='dev:sheet[Supplier.v3.tpl/List]' dddwdatacolumn='Name' dddwdisplaycolumn='Name' dddwwidth='' dddwheight='' dddwautoselect='N' dddwshowbutton='·ñ' dddwcanedit='ÊÇ'/>" +
|
L"</cellprop>";
|
dw_cell.SetCellProps(row, col, prop2);
|
dw_cell.Redraw();
|
}
|
else if (col == colTyp1 || col == colTyp)
|
{
|
xstring pitems1 = L"";
|
pitems1 += (xstring)L"<row><ÏÔʾÁÐ></ÏÔʾÁÐ><Êý¾ÝÁÐ>"
|
+ L"</Êý¾ÝÁÐ></row>";
|
pitems1 += (xstring)L"<row><ÏÔʾÁÐ>³ÉÆ·</ÏÔʾÁÐ><Êý¾ÝÁÐ>"
|
+ L"³ÉÆ·</Êý¾ÝÁÐ></row>";
|
pitems1 += (xstring)L"<row><ÏÔʾÁÐ>É¢»õ</ÏÔʾÁÐ><Êý¾ÝÁÐ>"
|
+ L"É¢»õ</Êý¾ÝÁÐ></row>";
|
pitems1 += (xstring)L"<row><ÏÔʾÁÐ>°ü×°</ÏÔʾÁÐ><Êý¾ÝÁÐ>"
|
+ L"°ü×°</Êý¾ÝÁÐ></row>";
|
xstring prop1 = (xstring)L"<cellprop searchcolumn='' celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='' cellvisibleex='' cellvisible='' cellneeddata='' cellvalid='' cellinitial='' cellsource='' fontstyle='' windowurl=''>" +
|
L"<edit edittype='ddlb' ddlbdataurl='' ddlbxml='<data>" + pitems1 + L"</data>'/>" +
|
L"</cellprop>";
|
dw_cell.SetCellProps(row, col, prop1);
|
}
|
|
|
|
if (((colPrice != col && colPrice1 != col) || row != ARow) && bPurchPrice)
|
{
|
if (bPurchPrice && action == L"purch")
|
{
|
xstring price0 = dw_cell.GetItemString(ARow, colPrice0);
|
xstring price1 = dw_cell.GetItemString(ARow, colPrice1);
|
xstring price = price0;
|
if (price0 != L"")
|
{
|
if (price0.find(L"A") < 1 && price0.find(L"B") < 1 && price0.find(L"C") < 1 && price0.find(L"a") < 1 && price0.find(L"b") < 1 && price0.find(L"b") < 1)
|
{
|
alert(L"¼Û¸ñÖÐûָ¶¨ABC");
|
}
|
}
|
if (price1 != L"")
|
{
|
if (price1.find(L"A") < 1 && price1.find(L"B") < 1 && price1.find(L"C") < 1 && price1.find(L"a") < 1 && price1.find(L"b") < 1 && price1.find(L"c") < 1)
|
{
|
alert(L"¼Û¸ñÖÐûָ¶¨ABC");
|
}
|
price = price0 + L"+" + price1;
|
}
|
dw_cell.SetItemString(ARow, colPrice, price);
|
}
|
}
|
if (colPrice0 != col && colPrice1 != col)
|
bPurchPrice = false;
|
else
|
bPurchPrice = true;
|
|
}
|
if (ARow != row) RowChanged(row);
|
ARow = row;
|
ACol = col;
|
orivalue = dw_cell.GetItemString(ARow, ACol);
|
|
return 1;
|
}
|
|
int OnImgDBClicked(TEvent* evt, LPARAM pr)
|
{
|
IMGNNMHDR& nmtv = *(IMGNNMHDR*)evt->notify.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 ;
|
|
//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);
|
SendMessage(m_winHwnd, 0x401, p, 0);
|
*/
|
return 1;
|
}
|
|
//ÃüÁî´¦Àíʼþ
|
int OnXCommand(TEvent * evt, LPARAM param)
|
{
|
return OnCmdDispatch(evt->xcommand.pStrID);
|
}
|
|
int OnAttachListon()
|
{
|
//°ó¶¨¹¤¾ßÌõµã»÷ʼþ
|
AttachEvent(L"WM_XCOMMAND", (FEvent)&QuoteFileView::OnXCommand);
|
//»ñÈ¡½¹µãʼþ£¬ÓÃÓÚÖØÖù¤¾ßÌõ
|
AttachEvent(L"WM_SETFOCUS", (FEvent)&QuoteFileView::OnSetFocus);
|
|
AttachEvent(L"frame:im1", L"IMG_LDBCLICK", (FEvent)&QuoteFileView::OnImgDBClicked);
|
|
AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&QuoteFileView::OnItemChanged);
|
AttachEvent(L"dw_goods", L"DWV_ROWFOCUSCHANGED", (FEvent)&QuoteFileView::OnRowChanged);
|
|
AttachEvent(L"dw_cell", L"DWV_CLICKED", (FEvent)&QuoteFileView::OnCellClicked);
|
AttachEvent(L"dw_cell", L"CELL_ITEMCHANGED", (FEvent)&QuoteFileView::OnCellItemChanged);
|
AttachEvent(L"dw_cell", L"CELL_SELECTCHANGED", (FEvent)&QuoteFileView::OnCellSelectChanged);
|
return 1;
|
}
|
|
/*
|
int OnRetrieve()
|
{
|
xml x ;
|
|
xaserverarg arg ;
|
|
arg.AddArg(L"xxx",L"xxx");
|
if (getUrl(L"",arg.GetString(),x)!=1)
|
{
|
trace(x.text());
|
return -1;
|
}else
|
{
|
//dw_list.Retrieve(x);
|
//dw_list.Redraw();
|
}
|
return 1;
|
}
|
*/
|
|
int SyncPurch(xml x)
|
{
|
int startRow = getItemHeadRow(dw_cell);
|
|
//ûÓÐÕÒµ½ÉÌÆ·ÐеıêÌâ
|
if (startRow < 1) return 0;
|
startRow++;
|
|
int colItemNo = getItemCol(dw_cell, startRow - 1, L"ÎÒ˾ÐͺÅ,ItemNo");
|
int colCustomerItemNo = getItemCol(dw_cell, startRow - 1, L"¿Í»§ÐͺÅ,Customer ItemNo,Customer Item No");
|
int colItemName = getItemCol(dw_cell, startRow - 1, L"Product Description,Product Name,Item Name");
|
int colItemCName = getItemCol(dw_cell, startRow - 1, L"ÖÐÎÄÆ·Ãû");
|
int colItemSpec = getItemCol(dw_cell, startRow - 1, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
int colBuyerPrice = getItemCol(dw_cell, startRow - 1, L"²É¹º¼Û,²É¹º¼Û¸ñ");
|
int colBuyer = getItemCol(dw_cell, startRow - 1, L"²É¹ºÈËÔ±");
|
|
int colBuyerMOQ = getItemCol(dw_cell, startRow - 1, L"MOQ");
|
int colBuyerRemark = getItemCol(dw_cell, startRow - 1, L"²É¹ºToÒµÎñ±¸×¢");
|
int colFactoryImage = getItemCol(dw_cell, startRow - 1, L"¹¤³§Í¼Æ¬");
|
int colGWT = getItemCol(dw_cell, startRow - 1, L"Ã«ÖØ,Ã«ÖØ(KG)");
|
int colNWT = getItemCol(dw_cell, startRow - 1, L"¾»ÖØ,¾»ÖØ(KG)");
|
int colVolDesc = getItemCol(dw_cell, startRow - 1, L"Ìå»ýÃèÊö,³¤X¿íX¸ß,³¤X¿íX¸ß(CM)");
|
int colVol = getItemCol(dw_cell, startRow - 1, L"Ìå»ý,Ìå»ý(M3)");
|
int col40HQ = getItemCol(dw_cell, startRow - 1, L"40HQ,QTY(40HQ)");
|
int colPurchedDate = getItemCol(dw_cell, startRow - 1, L"²É¹ºÌá½»ÒµÎñʱ¼ä");
|
int colPhoto1 = getItemCol(dw_cell, startRow - 1, L"¹¤³§Í¼Æ¬");
|
//int colProductInfo = getItemCol(dw_cell,startRow - 1,L"²úÆ·ÐÅÏ¢");
|
int colProductInfo = getItemCol(dw_cell, startRow - 1, L"ÒµÎñ²¿²úÆ·ÐÅÏ¢");
|
int colProductInfo1 = getItemCol(dw_cell, startRow - 1, L"²É¹º²¿²úÆ·ÐÅÏ¢");
|
|
int LastRow = dw_cell.GetValidRow();
|
KXMLDOMNodeList items = x.selectNodes(L"//Item");
|
int size = items.length();
|
for (int i = 0; i < size; i++)
|
{
|
KXMLDOMElement ele = items.item(i);
|
xstring rowid = ele.selectSingleNode(L"RowID").text();
|
xstring BuyerPrice = ele.selectSingleNode(L"BuyerPrice").text();
|
xstring BuyerMOQ = L"";
|
xstring BuyerRemark = L"";
|
xstring FactoryImage = L"";
|
xstring GWT = L"";
|
xstring NWT = L"";
|
xstring VolDesc = L"";
|
xstring Vol = L"";
|
xstring F40HQ = L"";
|
xstring PurchedDate = L"";
|
xstring supplierphoto = L"";
|
xstring productInfo = L"";
|
xstring productInfo1 = L"";
|
xstring EnquiryLineID = L"";
|
xstring Buyer = L"";
|
|
if (ele.selectSingleNode(L"BuyerMOQ")) BuyerMOQ = ele.selectSingleNode(L"BuyerMOQ").text();
|
if (ele.selectSingleNode(L"BuyerRemark")) BuyerRemark = ele.selectSingleNode(L"BuyerRemark").text();
|
if (ele.selectSingleNode(L"FactoryImage"))FactoryImage = ele.selectSingleNode(L"FactoryImage").text();
|
if (ele.selectSingleNode(L"GWT")) GWT = ele.selectSingleNode(L"GWT").text();
|
if (ele.selectSingleNode(L"NWT")) NWT = ele.selectSingleNode(L"NWT").text();
|
if (ele.selectSingleNode(L"VolDesc")) VolDesc = ele.selectSingleNode(L"VolDesc").text();
|
if (ele.selectSingleNode(L"Vol")) Vol = ele.selectSingleNode(L"Vol").text();
|
if (ele.selectSingleNode(L"F40HQ")) F40HQ = ele.selectSingleNode(L"F40HQ").text();
|
if (ele.selectSingleNode(L"PurchedDate")) PurchedDate = ele.selectSingleNode(L"PurchedDate").text();
|
//trace(L"\r\n******" + PurchedDate);
|
if (ele.selectSingleNode(L"supplier-photo")) supplierphoto = ele.selectSingleNode(L"supplier-photo").text();
|
if (ele.selectSingleNode(L"ProductInfo")) productInfo = ele.selectSingleNode(L"ProductInfo").text();
|
if (ele.selectSingleNode(L"ProductInfo1")) productInfo1 = ele.selectSingleNode(L"ProductInfo1").text();
|
if (ele.selectSingleNode(L"EnquiryLineID")) EnquiryLineID = ele.selectSingleNode(L"EnquiryLineID").text();
|
if (ele.selectSingleNode(L"Buyer")) Buyer = ele.selectSingleNode(L"Buyer").text();
|
|
trace(L"\r\nsupplierphoto:" + supplierphoto);
|
for (int row = startRow; row <= LastRow; row++)
|
{
|
if (dw_cell.GetItemString(row, colItemName) == L"" &&
|
dw_cell.GetItemString(row, colItemSpec) == L"") break;
|
if (getRowID(dw_cell, row) == rowid)
|
{
|
dw_cell.SetItemString(row, colBuyerPrice, BuyerPrice);
|
dw_cell.SetItemString(row, colBuyerMOQ, BuyerMOQ);
|
dw_cell.SetItemString(row, colBuyerRemark, BuyerRemark);
|
dw_cell.SetItemString(row, colFactoryImage, FactoryImage);
|
dw_cell.SetItemString(row, colGWT, GWT);
|
dw_cell.SetItemString(row, colNWT, NWT);
|
dw_cell.SetItemString(row, colVolDesc, VolDesc);
|
dw_cell.SetItemString(row, colVol, Vol);
|
dw_cell.SetItemString(row, col40HQ, F40HQ);
|
dw_cell.SetItemString(row, colPurchedDate, PurchedDate);
|
dw_cell.SetItemString(row, colProductInfo, productInfo);
|
dw_cell.SetItemString(row, colProductInfo1, productInfo1);
|
if (Buyer != L"") dw_cell.SetItemString(row, colBuyer, Buyer);
|
if (EnquiryLineID != L"") setRowTerm(dw_cell, row, L"EnquiryLineID", EnquiryLineID);
|
if (supplierphoto != L"") setRowTerm(dw_cell, row, L"supplier-photo", supplierphoto);
|
|
xstring props = dw_cell.GetCellProps(row, colPhoto1);
|
props = L"<cellprop><edit edittype='image'/></cellprop>";
|
dw_cell.SetCellProps(row, colPhoto1, props);
|
|
break;
|
}
|
}
|
}
|
return 1;
|
}
|
|
int SyncPurch(xstring entityid)
|
{
|
xml x ;
|
|
xaserverarg arg ;
|
|
arg.AddArg(L"entityid", entityid);
|
//alert(id);
|
if (getUrl(L"/sale/data/TO/quote/purchared/item", arg.GetString(), x) != 1)
|
{
|
trace(x.text());
|
return -1;
|
}
|
return SyncPurch(x);
|
}
|
|
int OnRetrieve(xstring id)
|
{
|
xml x ;
|
|
xaserverarg arg ;
|
|
arg.AddArg(L"id", id);
|
//alert(id);
|
if (getUrl(L"/sale/data/Quote/maint", arg.GetString(), x) != 1)
|
{
|
trace(x.text());
|
return -1;
|
}
|
else
|
{
|
dw_base.Retrieve(x);
|
dw_base.Redraw();
|
dw_goods.Retrieve(x);
|
dw_goods.Redraw();
|
}
|
return 1;
|
}
|
|
xstring GetTryFirstAttr(xstring str, xstring term)
|
{
|
xstring foundStr = L" " + term + L"=";
|
wchar quote = L'"';
|
int pos = str.find(foundStr);
|
if (pos < 0) return L"";
|
pos += foundStr.length();
|
while (str.at(pos) == L' ')pos++;
|
if (str.at(pos) == L'\'')quote = L'\'';
|
int epos = ++pos;
|
while (str.at(epos) && str.at(epos) != quote)epos++;
|
if (!str.at(epos))return L"";
|
return str.mid(pos, epos - pos);
|
}
|
|
int onload()
|
{
|
SetArg();
|
Reset();
|
orivalue = L"";
|
ARow = 1;
|
ACol = 1;
|
|
tabsheet = L"tab_bill";
|
templateID = L"ECDDE57A-43EB-49DD-9287-DC5D0B29ECA1";
|
xstring templ = L"";
|
taskid = L"";
|
xaserverarg arg;
|
if (GetWinParam()) {
|
arg = GetArg();
|
templ = arg.GetArgString(L"template");
|
entityID = arg.GetArgString(L"EntityID");
|
taskid = arg.GetArgString(L"TaskID");
|
if (entityID != L"")action = L"open";
|
|
trace(L"\r\nentity:" + entityID + L" taskid:" + taskid);
|
}
|
dw_cell = GetControl(L"dw_cell");
|
|
if (templ != L"")
|
{
|
/*xml x ;
|
x.setNativePointer(x.CreateInstance());
|
x.loadXML(templ);
|
*/
|
action = L"purch";
|
action = GetTryFirstAttr(templ, L"action");
|
if (action == L"") action = L"purch";
|
entityItemID = GetTryFirstAttr(templ, L"TemplateItemID");
|
if (entityItemID == L"")entityItemID = GetTryFirstAttr(templ, L"ItemID");
|
#if 0
|
if (templ.find(L"action=\"") >= 0)
|
{
|
action = templ.mid(templ.find(L"action=\"") + 8, templ.find(L"\"", templ.find(L"action=\"") + 8) - (templ.find(L"action=\"") + 8));
|
}
|
if (action == L"") action = L"purch";
|
if (templ.find(L"TemplateItemID=\"") >= 0)
|
{
|
entityItemID = templ.mid(templ.find(L"TemplateItemID=\"") + 16, templ.find(L"\"", templ.find(L"TemplateItemID=\"") + 16) - (templ.find(L"TemplateItemID=\"") + 16));
|
}
|
if (entityItemID == L"")
|
{
|
if (templ.find(L" ItemID=\"") >= 0)
|
{
|
entityItemID = templ.mid(templ.find(L" ItemID=\"") + 9, templ.find(L"\"", templ.find(L" ItemID=\"") + 9) - (templ.find(L" ItemID=\"") + 9));
|
}
|
}
|
#endif
|
/*action = x.documentElement.getAttribute(L"action");
|
if(action==L"") action=L"purch";
|
entityItemID = x.documentElement.getAttribute(L"TemplateItemID");
|
if(entityItemID==L"")entityItemID = x.documentElement.getAttribute(L"ItemID");
|
*/
|
OpenDocument(entityItemID);
|
if (action == L"purched")
|
{
|
//SyncPurch(x);
|
SyncPurch(entityID);
|
}
|
}
|
else
|
{
|
/*
|
templateurl = L"/sale/view/Enquiry3/template/EnquiryQuote";
|
if(kind==L"2")
|
templateurl = L"/sale/view/Enquiry3/template/EnquiryBill";
|
|
dw_cell.openUrl(templateurl);
|
*/
|
//SetWindowText(GetHWND(),L"±¨¼ÛÎļþ:[new]");
|
}
|
|
ARow = 0;
|
ACol = 0;
|
bPurchPrice = false;
|
|
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.SetColumnState(L"CName", false);
|
dw_goods.SetColumnState(L"QuoteLineID", false);
|
dw_goods.SetColumnState(L"SKUID", 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 (entityID != L"")
|
{
|
OnRetrieve(entityID);
|
if (templ == L"")OpenDocumentEntity(entityID);
|
//if(action==L"purched")SyncPurch(x);
|
}
|
else
|
{
|
if (templ == L"")
|
{
|
OnInit();
|
OpenTemplate(templateID);
|
}
|
}
|
|
OnAttachListon();
|
filename = L"";
|
|
/* #define LayerFlow_None 0x00000001 //not layer space
|
#define LayerFlow_WE 0x00000002
|
#define LayerFlow_NS 0x00000004
|
#define LayerFlow_FreeForm 0x00000008
|
#define LayerFlow_Control 0x00000010
|
#define LayerFlow_HtmlFlow 0x00000020
|
#define LayerFlow_Sheets 0x00000040
|
#define LayerFlow_Hidden 0x00000080 //not show but layer space
|
#define LayerFlow_UnLayer 0x00000100 //not show and not layer space
|
|
#define LayerFlow_NotLayerNode (LayerFlow_None | LayerFlow_UnLayer)
|
#define LayerFlow_LayerChild (LayerFlow_WE|LayerFlow_NS|LayerFlow_FreeForm|LayerFlow_Sheets| LayerFlow_HtmlFlow )
|
*/
|
|
if (action == L"purch")
|
{
|
xnode anode = GetAgentNode(L"tabheader");
|
anode.SetLayerFlow(0x00000100);
|
dw_cell.SetColumnCount(dw_cell.GetValidCol() + 6);
|
}
|
else
|
dw_cell.SetColumnCount(dw_cell.GetValidCol()+3);
|
|
//OnRetrieve();
|
|
return 1;
|
}
|
|
xstring GetMySupplier()
|
{
|
int startRow = getItemHeadRow(dw_cell);
|
|
//ûÓÐÕÒµ½ÉÌÆ·ÐеıêÌâ
|
if (startRow < 1) return L"<data/>";
|
startRow++;
|
|
int colItemName = getItemCol(dw_cell, startRow - 1, L"Product Description,Product Name,Item Name");
|
int colItemSpec = getItemCol(dw_cell, startRow - 1, L"Specifications,¹æ¸ñ,²úÆ·¹æ¸ñ");
|
|
int colSupplier1 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ1");
|
int colSupplier2 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ2");
|
int colSupplier3 = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ3");
|
int colSupplier = getItemCol(dw_cell, startRow - 1, L"¹©Ó¦ÉÌ");
|
|
int LastRow = dw_cell.GetValidRow();
|
xstring content = L"";
|
for (int row = startRow; row <= LastRow; row++)
|
{
|
if (dw_cell.GetItemString(row, colItemName) == L"" &&
|
dw_cell.GetItemString(row, colItemSpec) == L"") break;
|
|
xstring itemStr = L"";
|
if (colSupplier >= 1)
|
{
|
if (dw_cell.GetItemString(row, colSupplier) != L"")
|
{
|
if (hasParty(dw_cell.GetItemString(row, colSupplier)) == false)
|
{
|
itemStr += L"<Item update.new='1' update.modify='1'>";
|
itemStr += L"<Name>" + dw_cell.GetItemString(row, colSupplier) + L"</Name>";
|
itemStr += L"<ShortName>" + dw_cell.GetItemString(row, colSupplier) + L"</ShortName>";
|
itemStr += L"</Item>";
|
}
|
}
|
}
|
if (colSupplier1 >= 1)
|
{
|
if (dw_cell.GetItemString(row, colSupplier1) != L"")
|
{
|
if (hasParty(dw_cell.GetItemString(row, colSupplier1)) == false)
|
{
|
itemStr += L"<Item update.new='1' update.modify='1'>";
|
itemStr += L"<Name>" + dw_cell.GetItemString(row, colSupplier1) + L"</Name>";
|
itemStr += L"<ShortName>" + dw_cell.GetItemString(row, colSupplier1) + L"</ShortName>";
|
itemStr += L"</Item>";
|
}
|
}
|
}
|
if (colSupplier2 >= 1)
|
{
|
if (dw_cell.GetItemString(row, colSupplier2) != L"")
|
{
|
if (hasParty(dw_cell.GetItemString(row, colSupplier2)) == false)
|
{
|
itemStr += L"<Item update.new='1' update.modify='1'>";
|
itemStr += L"<Name>" + dw_cell.GetItemString(row, colSupplier2) + L"</Name>";
|
itemStr += L"<ShortName>" + dw_cell.GetItemString(row, colSupplier2) + L"</ShortName>";
|
itemStr += L"</Item>";
|
}
|
}
|
}
|
if (colSupplier3 >= 1)
|
{
|
if (dw_cell.GetItemString(row, colSupplier3) != L"")
|
{
|
if (hasParty(dw_cell.GetItemString(row, colSupplier3)) == false)
|
{
|
itemStr += L"<Item update.new='1' update.modify='1'>";
|
itemStr += L"<Name>" + dw_cell.GetItemString(row, colSupplier3) + L"</Name>";
|
itemStr += L"<ShortName>" + dw_cell.GetItemString(row, colSupplier3) + L"</ShortName>";
|
itemStr += L"</Item>";
|
}
|
}
|
}
|
if (itemStr != L"") content += itemStr;
|
}
|
xstring newEntityItemID = ViewObject::GetGuid();
|
content = L"<data>" + content + L"</data>";
|
return content;
|
}
|
|
|
int OnMySupplier()
|
{
|
if (action != L"purch") return 1;
|
xstring content = GetMySupplier();
|
xaserverarg arg ;
|
|
arg.AddArg(L"value", content);
|
OpenWindow(L"dev:xpage[QuoteSupplierItem.vx]", arg);
|
|
return 1;
|
}
|
|
bool hasParty(xstring name)
|
{
|
xml x ;
|
xaserverarg arg ;
|
|
arg.AddArg(L"Name", name);
|
if (getUrl(L"/sale/data/SupplierV3/HasParty", arg.GetString(), x) != 1)
|
{
|
alert((xstring)L"error:" + x.xml());
|
}
|
xstring count = x.documentElement().getAttribute(L"count");
|
if (count != L"0") return true;
|
|
return false;
|
}
|
|
int LoadPurcher()
|
{
|
//xml purcher ;
|
xaserverarg arg ;
|
|
arg.AddArg(L"id", L"²É¹ºÔ±");
|
if (getUrl(L"/sale/data/Quote/Purcher", arg.GetString(), purcher) != 1)
|
{
|
alert((xstring)L"error:" + purcher.xml());
|
}
|
return 1;
|
}
|
|
xstring GetPurchorByName(xstring name)
|
{
|
KXMLDOMNode n = purcher.selectSingleNode(L"//HrEmployee[Name='" + name + L"']/EmployeeID");
|
if (n)
|
{
|
return n.text();
|
}
|
else
|
return L"";
|
|
}
|
|
int onloaded()
|
{
|
SetAgent();
|
LoadPurcher();
|
|
xaserverarg arg;
|
if (GetWinParam()) {
|
arg = GetArg();
|
if (arg.GetArgString(L"bill.purchor") == L"1") OnNextPurch();
|
}
|
return 1;
|
}
|
};
|