This commit is contained in:
@@ -1748,7 +1748,7 @@ namespace AyaNova.PlugIn.V8
|
|||||||
#endregion Projects
|
#endregion Projects
|
||||||
|
|
||||||
#region PurchaseOrders
|
#region PurchaseOrders
|
||||||
|
|
||||||
private async System.Threading.Tasks.Task ExportPurchaseOrders(ProgressForm progress)
|
private async System.Threading.Tasks.Task ExportPurchaseOrders(ProgressForm progress)
|
||||||
{
|
{
|
||||||
if (!progress.KeepGoing) return;
|
if (!progress.KeepGoing) return;
|
||||||
@@ -1771,16 +1771,16 @@ namespace AyaNova.PlugIn.V8
|
|||||||
if (!progress.KeepGoing) return;
|
if (!progress.KeepGoing) return;
|
||||||
List<string> tags = new List<string>();
|
List<string> tags = new List<string>();
|
||||||
AddImportTag(tags);
|
AddImportTag(tags);
|
||||||
PurchaseOrder c = PurchaseOrder.GetItem(i.LT_PurchaseOrder_Label_PONumber.Value);
|
PurchaseOrder c = PurchaseOrder.GetItem(i.LT_PurchaseOrder_Label_PONumber.Value);
|
||||||
var ObjectTID = new TypeAndID(RootObjectTypes.PurchaseOrder, c.ID);
|
var ObjectTID = new TypeAndID(RootObjectTypes.PurchaseOrder, c.ID);
|
||||||
dynamic d = new JObject();
|
dynamic d = new JObject();
|
||||||
d.serial = c.PONumber;
|
d.serial = c.PONumber;
|
||||||
if (IsDuplicatev7v8IdMapItem(c.ID, i.LT_PurchaseOrder_Label_PONumber.Display, progress)) continue;
|
if (IsDuplicatev7v8IdMapItem(c.ID, i.LT_PurchaseOrder_Label_PONumber.Display, progress)) continue;
|
||||||
progress.Op(ObjectTypeName + " " + d.name);
|
progress.Op(ObjectTypeName + " " + d.name);
|
||||||
|
|
||||||
d.notes = c.Notes;
|
d.notes = c.Notes;
|
||||||
d.vendorMemo = c.VendorMemo;
|
d.vendorMemo = c.VendorMemo;
|
||||||
d.dropShipToCustomerId =Getv7v8IdMapNullOk(c.DropShipToClientID);
|
d.dropShipToCustomerId = Getv7v8IdMapNullOk(c.DropShipToClientID);
|
||||||
d.referenceNumber = c.ReferenceNumber;
|
d.referenceNumber = c.ReferenceNumber;
|
||||||
d.vendorId = Getv7v8IdMap(c.VendorID, "Vendor for PO");
|
d.vendorId = Getv7v8IdMap(c.VendorID, "Vendor for PO");
|
||||||
d.orderedDate = util.DateToV8(c.OrderedDate);
|
d.orderedDate = util.DateToV8(c.OrderedDate);
|
||||||
@@ -1801,27 +1801,58 @@ namespace AyaNova.PlugIn.V8
|
|||||||
//even though list has almost everything else needed
|
//even though list has almost everything else needed
|
||||||
List<PurchaseOrderReceipt> receipts = new List<PurchaseOrderReceipt>();
|
List<PurchaseOrderReceipt> receipts = new List<PurchaseOrderReceipt>();
|
||||||
foreach (PurchaseOrderReceiptListDetailed.PurchaseOrderReceiptListDetailedInfo prli in prl)
|
foreach (PurchaseOrderReceiptListDetailed.PurchaseOrderReceiptListDetailedInfo prli in prl)
|
||||||
{
|
{
|
||||||
receipts.Add(PurchaseOrderReceipt.GetItem(prli.LT_O_PurchaseOrderReceipt.Value));
|
receipts.Add(PurchaseOrderReceipt.GetItem(prli.LT_O_PurchaseOrderReceipt.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dynamic dItems = new JArray();
|
||||||
foreach (PurchaseOrderItem pi in c.OrderItems)
|
foreach (PurchaseOrderItem pi in c.OrderItems)
|
||||||
{
|
{
|
||||||
//here combine potiem and poreceipts into singular items for v8
|
//here combine potiem and poreceipts into singular items for v8
|
||||||
//also compile all text1,text2 to put into header for v8 later
|
//also compile all text1,text2 to put into header for v8 later
|
||||||
|
|
||||||
//iterate receipt list find id's fetch actual receipts which contain exactly which poitem they were received against
|
//iterate receipt list find id's fetch actual receipts which contain exactly which poitem they were received against
|
||||||
//also, keep track of required woitempartrequestid's for later so can fixup when the time comes
|
//also, keep track of required woitempartrequestid's for later so can fixup when the time comes
|
||||||
|
|
||||||
|
dynamic dItem = new JObject();
|
||||||
|
dItem.purchaseOrderId = 0;
|
||||||
|
dItem.partId = Getv7v8IdMap(pi.PartID, "part for poitem");
|
||||||
|
dItem.partWarehouseId = Getv7v8IdMap(pi.PartWarehouseID, "warehouse for poitem");
|
||||||
|
dItem.quantityOrdered = pi.QuantityOrdered;
|
||||||
|
dItem.quantityReceived = 0;
|
||||||
|
dItem.serials=string.Empty;
|
||||||
|
dItem.purchaseOrderCost = pi.PurchaseOrderCost;
|
||||||
|
dItem.partRequestedById = Getv7v8IdMapNullOk(pi.PartRequestedByID);
|
||||||
|
foreach (PurchaseOrderReceipt r in receipts)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(r.Text1))
|
||||||
|
sbText1.Append(r.Text1+",");
|
||||||
|
if (!string.IsNullOrWhiteSpace(r.Text2))
|
||||||
|
sbText2.Append(r.Text2 + ",");
|
||||||
|
|
||||||
|
foreach (PurchaseOrderReceiptItem ri in r.Items)
|
||||||
|
{
|
||||||
|
if (ri.PurchaseOrderItemID == pi.ID)
|
||||||
|
{
|
||||||
|
//Note: in v7 must receive to same warehouse as ordered, no option otherwise so no need
|
||||||
|
//to worry about that here
|
||||||
|
dItem.quantityReceived += ri.QuantityReceived;
|
||||||
|
dItem.receivedCost = ri.ReceiptCost;
|
||||||
|
//ri.SerialNumbers
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//dItem.quantityReceived=//tbc
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Tagit(c.RegionID, tags);
|
// Tagit(c.RegionID, tags);
|
||||||
SetTags(d, tags);
|
SetTags(d, tags);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user