|
@@ -137,41 +137,41 @@ public class SupplierBillLineGrid : DynamicOneToManyGrid<Bill, BillLine>
|
|
|
var imports = dlg.Items();
|
|
|
var poids = imports.Select(x => x.PurchaseOrderLink.ID).Distinct().ToArray();
|
|
|
var consids = imports.Select(x => x.Consignment.ID).Distinct().ToArray();
|
|
|
- MultiQuery query = new MultiQuery();
|
|
|
-
|
|
|
- query.Add<PurchaseOrderItem>(
|
|
|
- new Filter<PurchaseOrderItem>(x => x.ID).InList(dlg.IDs()),
|
|
|
- new Columns<PurchaseOrderItem>(x => x.ID)
|
|
|
- .Add(x => x.Description)
|
|
|
- .Add(x => x.TaxCode.ID)
|
|
|
- .Add(x => x.TaxCode.Code)
|
|
|
- .Add(x => x.TaxCode.Description)
|
|
|
- .Add(x => x.TaxCode.Rate)
|
|
|
- .Add(x => x.Qty)
|
|
|
- .Add(x => x.TaxRate)
|
|
|
- .Add(x => x.ExTax)
|
|
|
- .Add(x => x.Tax)
|
|
|
- .Add(x => x.IncTax)
|
|
|
- .Add(x => x.Created)
|
|
|
- .Add(x => x.PurchaseOrderLink.ID)
|
|
|
- .Add(x => x.PurchaseOrderLink.PONumber)
|
|
|
- .Add(x => x.Consignment.ID)
|
|
|
- .Add(x => x.Product.ID)
|
|
|
- .Add(x => x.Product.Code)
|
|
|
- .Add(x => x.Product.Name)
|
|
|
- .Add(x => x.PurchaseGL.ID)
|
|
|
- .Add(x => x.CostCentre.ID)
|
|
|
- );
|
|
|
-
|
|
|
- query.Add<PurchaseOrderDocument>(
|
|
|
- new Filter<PurchaseOrderDocument>(x=>x.EntityLink.ID).InList(poids));
|
|
|
|
|
|
- query.Add<ConsignmentDocument>(
|
|
|
- new Filter<ConsignmentDocument>(x => x.EntityLink.ID).InList(consids));
|
|
|
-
|
|
|
- query.Query();
|
|
|
+ var results = Client.QueryMultiple(
|
|
|
+ new KeyedQueryDef<PurchaseOrderItem>(
|
|
|
+ new Filter<PurchaseOrderItem>(x => x.ID).InList(dlg.IDs()),
|
|
|
+ new Columns<PurchaseOrderItem>(x => x.ID)
|
|
|
+ .Add(x => x.Description)
|
|
|
+ .Add(x => x.TaxCode.ID)
|
|
|
+ .Add(x => x.TaxCode.Code)
|
|
|
+ .Add(x => x.TaxCode.Description)
|
|
|
+ .Add(x => x.TaxCode.Rate)
|
|
|
+ .Add(x => x.Qty)
|
|
|
+ .Add(x => x.TaxRate)
|
|
|
+ .Add(x => x.ExTax)
|
|
|
+ .Add(x => x.Tax)
|
|
|
+ .Add(x => x.IncTax)
|
|
|
+ .Add(x => x.Created)
|
|
|
+ .Add(x => x.PurchaseOrderLink.ID)
|
|
|
+ .Add(x => x.PurchaseOrderLink.PONumber)
|
|
|
+ .Add(x => x.Consignment.ID)
|
|
|
+ .Add(x => x.Product.ID)
|
|
|
+ .Add(x => x.Product.Code)
|
|
|
+ .Add(x => x.Product.Name)
|
|
|
+ .Add(x => x.PurchaseGL.ID)
|
|
|
+ .Add(x => x.CostCentre.ID)),
|
|
|
+ new KeyedQueryDef<Document>(
|
|
|
+ new Filter<Document>(x => x.ID).InQuery(
|
|
|
+ new Filter<PurchaseOrderDocument>(x => x.EntityLink.ID).InList(poids),
|
|
|
+ x => x.DocumentLink.ID)
|
|
|
+ .Or(x => x.ID).InQuery(
|
|
|
+ new Filter<PurchaseOrderDocument>(x => x.EntityLink.ID).InList(poids),
|
|
|
+ x => x.DocumentLink.ID),
|
|
|
+ new Columns<Document>(x => x.ID)
|
|
|
+ .Add(x => x.FileName)));
|
|
|
|
|
|
- var items = query.Get<PurchaseOrderItem>();
|
|
|
+ var items = results.Get<PurchaseOrderItem>();
|
|
|
foreach (var row in items.Rows)
|
|
|
{
|
|
|
var line = CreateItem();
|
|
@@ -217,27 +217,16 @@ public class SupplierBillLineGrid : DynamicOneToManyGrid<Bill, BillLine>
|
|
|
|
|
|
if (docpage != null)
|
|
|
{
|
|
|
- var podocs = query.Get<PurchaseOrderDocument>();
|
|
|
- foreach (var row in podocs.Rows)
|
|
|
+ var docs = results.Get<Document>();
|
|
|
+ foreach (var row in docs.Rows)
|
|
|
{
|
|
|
- var podoc = new BillDocument();
|
|
|
- podoc.EntityLink.ID = Item.ID;
|
|
|
- podoc.DocumentLink.ID = row.Get<PurchaseOrderDocument, Guid>(x => x.DocumentLink.ID);
|
|
|
- podoc.DocumentLink.FileName = row.Get<PurchaseOrderDocument, String>(x => x.DocumentLink.FileName);
|
|
|
- podoc.Thumbnail = row.Get<PurchaseOrderDocument, byte[]>(x => x.Thumbnail);
|
|
|
- docpage.SaveItem(podoc);
|
|
|
+ var doc = new BillDocument();
|
|
|
+ doc.EntityLink.ID = Item.ID;
|
|
|
+ doc.DocumentLink.ID = row.Get<Document, Guid>(x => x.ID);
|
|
|
+ doc.DocumentLink.FileName = row.Get<Document, string>(x => x.FileName);
|
|
|
+ docpage.SaveItem(doc);
|
|
|
}
|
|
|
|
|
|
- var consdocs = query.Get<ConsignmentDocument>();
|
|
|
- foreach (var row in consdocs.Rows)
|
|
|
- {
|
|
|
- var consdoc = new BillDocument();
|
|
|
- consdoc.EntityLink.ID = Item.ID;
|
|
|
- consdoc.DocumentLink.ID = row.Get<ConsignmentDocument, Guid>(x => x.DocumentLink.ID);
|
|
|
- consdoc.DocumentLink.FileName = row.Get<ConsignmentDocument, String>(x => x.DocumentLink.FileName);
|
|
|
- consdoc.Thumbnail = row.Get<ConsignmentDocument, byte[]>(x => x.Thumbnail);
|
|
|
- docpage.SaveItem(consdoc);
|
|
|
- }
|
|
|
docpage.Refresh(false,true);
|
|
|
}
|
|
|
DoChanged();
|