Job Cost Entry file watcher
Hey guys,
Most of the file watchers I have built create sales order entries. I now have a requirement to create a job cost entry batch.
The requirement is that a CSV file will produce job cost entry batch with each CSV line adding a detail line to the batch. Each detail line's job costing is matched from the CSV job no (and is always the stage B costing), and its item matched from the CSV inventory part no.
I'm stuck zeroing in on the correct entities and methods to do this. I've trawled the forums and even scanned through the object browser, but I can't locate anything that looks suitable.
Here's my pseudocode. I'm hoping its just a matter of substituting the correct entity class names, and tweaking the Create/Read methods.
Thanks in advance!
Cheers,
Neil
Most of the file watchers I have built create sales order entries. I now have a requirement to create a job cost entry batch.
The requirement is that a CSV file will produce job cost entry batch with each CSV line adding a detail line to the batch. Each detail line's job costing is matched from the CSV job no (and is always the stage B costing), and its item matched from the CSV inventory part no.
I'm stuck zeroing in on the correct entities and methods to do this. I've trawled the forums and even scanned through the object browser, but I can't locate anything that looks suitable.
Here's my pseudocode. I'm hoping its just a matter of substituting the correct entity class names, and tweaking the Create/Read methods.
- Code: Select all
var jobCostEntry = manager.BusinessLogicFactory.CreateBusinessLogic<JobCostEntry>(null);
jobCostEntry.CreateNew();
jobCostEntry.Reference = "REFERENCE";
foreach (var csvLine in csvLines)
{
var jobCosting = manager.EntityFactory.CreateEntity<JobCode>();
jobCosting.ReadRecordFromJobNo(csvLine.JobNo, Stage.B);
var inventory = manager.EntityFactory.CreateEntity<Inventory>();
inventory.ReadRecordFromPartNo(csvLine.PartNo);
jobCostEntry.JobCostEntryLines.AddInventoryItem(jobCosting.JobCostingID, inventory.InventoryID, ref newKey);
var orderLine = jobCostEntry.SalesOrderLines[newKey.ToString()];
orderLine.QuantityOrdered = csvLine.Qty;
orderLine.Save();
}
jobCostEntry.Save();
Thanks in advance!
Cheers,
Neil