public ScanAcc(DocLine d) { InitializeComponent(); txfAccCode.Focused += Entry_Focused; UsingDoc = d; lblMainAcc.Text = UsingDoc.SupplierName + " - " + UsingDoc.DocNum; }
private void LoadTree(g group, List <DocLine> listLines) { DocLine docLast = null; foreach (polyline p in group.polyline) { DocLine docLine = new DocLine(); LoadPoints(p, docLine.DiagramLine); if (docLast != null && docLine.DiagramLine.Count > 1 && docLine.DiagramLine[0].Equals(docLast.DiagramLine[docLast.DiagramLine.Count - 1])) { // hierarchy docLast.Tree.Add(docLine); } else { listLines.Add(docLine); } if (docLast == null && docLine.DiagramLine.Count > 1) { docLast = docLine; } } }
private async void lstItems_ItemSelected(object sender, SelectedItemChangedEventArgs e) { DocLine dl = e.SelectedItem as DocLine; string output = await DisplayActionSheet("Reset Qty to zero for this item on this pallet?", "YES", "NO"); switch (output) { case "NO": break; case "YES": if (Connectivity.NetworkAccess == NetworkAccess.Internet) { if (await ResetItem(dl)) { await GoodsRecieveingApp.App.Database.DeleteAllWithItemWithFilter(dl); await RefreshList(); } } else { Vibration.Vibrate(); message.DisplayMessage("No Internet Connection", true); } break; } }
public async Task <IActionResult> Edit(Guid id, [Bind("GoodId,DocHeadId,Price,Quantity,Id")] DocLine docLine) { if (id != docLine.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(docLine); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DocLineExists(docLine.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DocHeadId"] = new SelectList(_context.Docs, "Id", "Id", docLine.DocHeadId); ViewData["GoodId"] = new SelectList(_context.Goods, "Id", "Id", docLine.GoodId); return(View(docLine)); }
private DocLine[] LoadLines(MProfitLoss pay) { List <DocLine> list = new List <DocLine>(); MProfitLossLines[] lines = pay.GetLines(false); //C_AcctSchema = Util.GetValueOfInt(DB.ExecuteScalar("SELECT c_acctschema1_id FROM AD_ClientInfo WHERE AD_Client_ID=" + GetAD_Client_ID())); for (int i = 0; i < lines.Length; i++) { MProfitLossLines line = lines[i]; DocLine docLine = new DocLine(line, this); docLine.SetAmount(line.GetC_ProfitAndLoss_ID() != 0 ? line.GetAccountDebit() : Math.Abs(line.GetAccountDebit()), line.GetC_ProfitAndLoss_ID() != 0 ? line.GetAccountCredit():Math.Abs(line.GetAccountCredit())); //docLine.SetConvertedAmt(line.GetC_AcctSchema_ID(), line.GetAccountDebit(), line.GetAccountCredit()); // set primary key value docLine.SetPrimaryKeyValue(line.GetC_ProfitLossLines_ID()); // set GL journal line table ID docLine.SetLineTable_ID(line.Get_Table_ID()); // list.Add(docLine); } // Return Array DocLine[] dls = new DocLine[list.Count]; dls = list.ToArray(); return(dls); }
async Task MarAsRecieved() { List<DocLine> lines = (await App.Database.GetSpecificDocsAsync(docCode)).Where(x => !x.GRN).ToList(); foreach (string itemCode in lines.Select(x => x.ItemCode).Distinct()) { if (lines.Where(x => x.ItemCode == itemCode && (x.ScanAccQty > 0 || x.ScanRejQty > 0)).Count() > 0) { DocLine GRVItem = (await App.Database.GetSpecificDocsAsync(docCode)).Where(x => x.GRN && x.ItemCode == itemCode).FirstOrDefault(); if (GRVItem != null) { GRVItem.ScanAccQty = lines.Where(x => x.ItemCode == itemCode).Sum(x => x.ScanAccQty); GRVItem.ScanRejQty = lines.Where(x => x.ItemCode == itemCode).Sum(x => x.ScanRejQty); await App.Database.Update(GRVItem); } else { await App.Database.Insert(new DocLine { DocNum = docCode, ItemCode = itemCode, ItemBarcode = lines.Where(x => x.ItemQty != 0 && x.ItemCode == itemCode).FirstOrDefault().ItemBarcode, Balacnce = 0, ScanAccQty = lines.Where(x => x.ItemCode == itemCode).Sum(x => x.ScanAccQty), ScanRejQty = lines.Where(x => x.ItemCode == itemCode).Sum(x => x.ScanRejQty), PalletNum = lines.Where(x => x.ItemQty != 0 && x.ItemCode == itemCode).FirstOrDefault().PalletNum, GRN = true, ItemQty = 0 }); } foreach (DocLine dl in lines.Where(x => x.ItemCode == itemCode)) { dl.ScanAccQty = 0; dl.ScanRejQty = 0; await App.Database.Update(dl); } foreach (DocLine docLine in lines.Where(x => x.ItemQty == 0 && x.ScanAccQty == 0 && x.ScanRejQty == 0)) { await App.Database.Delete(docLine); } } } }
public async Task DeleteAllWithItemWithFilter(DocLine d) { foreach (DocLine doc in await database.Table <DocLine>().Where(x => x.DocNum == d.DocNum && x.ItemDesc == d.ItemDesc && x.PalletNum == d.PalletNum).ToListAsync()) { await database.DeleteAsync(doc); } }
private async Task <bool> ResetItem() { DocLine doc = (await App.Database.GetSpecificDocsAsync(UsingDoc.DocNum)).Where(x => x.ItemCode == lastItem).FirstOrDefault(); var ds = new DataSet(); try { var t1 = new DataTable(); DataRow row = null; t1.Columns.Add("DocNum"); t1.Columns.Add("ItemBarcode"); t1.Columns.Add("ScanAccQty"); t1.Columns.Add("Balance"); t1.Columns.Add("ScanRejQty"); t1.Columns.Add("PalletNumber"); t1.Columns.Add("GRV"); row = t1.NewRow(); row["DocNum"] = doc.DocNum; row["ItemBarcode"] = doc.ItemBarcode; row["ScanAccQty"] = 0; row["Balance"] = 0; row["ScanRejQty"] = 0; row["PalletNumber"] = 0; row["GRV"] = false; t1.Rows.Add(row); ds.Tables.Add(t1); string myds = Newtonsoft.Json.JsonConvert.SerializeObject(ds); RestSharp.RestClient client = new RestSharp.RestClient(); client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath); { var Request = new RestSharp.RestRequest("SaveDocLine", RestSharp.Method.POST); Request.RequestFormat = RestSharp.DataFormat.Json; Request.AddJsonBody(myds); var cancellationTokenSource = new CancellationTokenSource(); var res = await client.ExecuteAsync(Request, cancellationTokenSource.Token); if (res.IsSuccessful && res.Content.Contains("COMPLETE")) { await restetQty(doc); lblBalance.Text = "0"; lblScanQTY.Text = ""; lblOrderQTY.Text = ""; lblitemDescAcc.Text = ""; PicImage.IsVisible = false; txfAccCode.Focus(); return(true); } else { return(false); } } } catch (Exception) { } return(false); }
private async void txfPOCode_Completed(object sender, EventArgs e) { if (txfPOCode.Text.Length == 8) { LodingIndiactor.IsVisible = true; if (await GetItems(txfPOCode.Text.ToUpper())) { _ = GetDocStatus(); DocLine d = await App.Database.GetOneSpecificDocAsync(txfPOCode.Text.ToUpper()); lblCompany.Text = d.SupplierName.ToUpper(); lblPONum.Text = txfPOCode.Text.ToUpper(); lblCompany.IsVisible = true; lblPONum.IsVisible = true; txfPOCode.IsEnabled = false; txfPOCode.IsVisible = false; lblPOCode.IsVisible = false; btnAccept.IsVisible = true; btnRej.IsVisible = true; btnAll.IsVisible = true; //ToolbarItem item = new ToolbarItem() //{ // Text = "Save" //}; //item.Clicked += SaveClicked; //this.ToolbarItems.Add(item); try { await App.Database.Delete(await App.Database.GetHeader(d.DocNum)); } catch { } try { await App.Database.Insert(new DocHeader { DocNum = txfPOCode.Text, PackerUser = UserCode, AccName = d.SupplierName, AcctCode = d.SupplierCode }); } catch { } LodingIndiactor.IsVisible = false; //await DisplayAlert("Done", "All the data has been loaded for this order", "OK"); } else { txfPOCode.Text = ""; txfPOCode.Focus(); } } else { await DisplayAlert("Error!", "Invalid Document Number", "OK"); Vibration.Vibrate(); } }
public async Task<bool> restetQty(DocLine d) { List<DocLine> dls = await GoodsRecieveingApp.App.Database.GetSpecificDocsAsync(d.DocNum); foreach (DocLine docline in dls.Where(x => x.ItemCode == d.ItemCode && x.ItemQty == 0)) { await GoodsRecieveingApp.App.Database.Delete(docline); } return true; }
private async void ButtonAccepted_Clicked(object sender, EventArgs e) { if (txfPOCode.Text.ToString().Length > 1) { DocLine dl = await App.Database.GetOneSpecificDocAsync(txfPOCode.Text.ToUpper()); await Navigation.PushAsync(new ScanAcc(dl)); } }
/// <summary> /// Create Facts (the accounting logic) for /// CMC. /// <pre> /// Expense /// CashExpense DR /// CashAsset CR ///Receipt /// CashAsset DR /// CashReceipt CR /// Charge /// Charge DR /// CashAsset CR /// Difference /// CashDifference DR /// CashAsset CR /// Invoice /// CashAsset DR /// CashTransfer CR /// Transfer /// BankInTransit DR /// CashAsset CR /// </pre> /// </summary> /// <param name="?"></param> /// <returns>Fact</returns> public override List <Fact> CreateFacts(MAcctSchema as1) { // create Fact Header List <Fact> facts = new List <Fact>(); if (GetDocumentType().Equals(MDocBaseType.DOCBASETYPE_PROFITLOSS)) { // Decimal grossAmt = getAmount(Doc.AMTTYPE_Gross); SetC_Currency_ID(GetCurrency(as1.GetC_AcctSchema_ID())); // Commitment Fact fact = new Fact(this, as1, Fact.POST_Actual); Decimal total = Env.ZERO, totalCredit = Env.ZERO, totalDebit = Env.ZERO; Decimal credit = Env.ZERO, debit = Env.ZERO; for (int i = 0; i < _lines.Length; i++) { DocLine dline = _lines[i]; MProfitLossLines line = new MProfitLossLines(GetCtx(), dline.Get_ID(), null); credit = Util.GetValueOfDecimal(dline.GetAmtAcctCr()); debit = Util.GetValueOfDecimal(dline.GetAmtAcctDr()); if (credit > 0) { totalCredit = Decimal.Add(totalCredit, credit); } if (debit > 0) { totalDebit = Decimal.Add(totalDebit, debit); } // Account MAccount expense = MAccount.Get(GetCtx(), GetAD_Client_ID(), GetAD_Org_ID(), line.GetC_AcctSchema_ID(), line.GetAccount_ID(), line.GetC_SubAcct_ID(), line.GetM_Product_ID(), line.GetC_BPartner_ID(), line.GetAD_OrgTrx_ID(), line.GetC_LocFrom_ID(), line.GetC_LocTo_ID(), line.GetC_SalesRegion_ID(), line.GetC_Project_ID(), line.GetC_Campaign_ID(), line.GetC_Activity_ID(), line.GetUser1_ID(), line.GetUser2_ID(), line.GetUserElement1_ID(), line.GetUserElement2_ID()); fact.CreateLine(dline, expense, GetCurrency(line.GetC_AcctSchema_ID()), debit, credit); } total = totalCredit - totalDebit; if (total != Env.ZERO) { int validComID = Util.GetValueOfInt(DB.ExecuteScalar(@"SELECT IncomeSummary_Acct FROM C_AcctSchema_GL WHERE C_AcctSchema_ID=" + as1.GetC_AcctSchema_ID() + " AND AD_Client_ID = " + GetAD_Client_ID())); MAccount acct = MAccount.Get(GetCtx(), validComID); fact.CreateLine(null, acct, GetC_Currency_ID(), total); } //if (TotalCurrLoss != Env.ZERO) //{ // int validComID = Util.GetValueOfInt(DB.ExecuteScalar(@"SELECT C_ValidCombination_ID FROM C_ValidCombination WHERE Account_ID= ( SELECT C_ElementValue_ID FROM C_ElementValue WHERE Value='82540' AND AD_Client_ID = " + GetAD_Client_ID() + " )")); // MAccount acct = MAccount.Get(GetCtx(), validComID); // TotalCurrLoss = MConversionRate.Convert(GetCtx(), TotalCurrLoss, childCashCurrency, headerCashCurrency, GetAD_Client_ID(), GetAD_Org_ID()); // fact.CreateLine(null, acct, // GetC_Currency_ID(), (TotalCurrLoss)); //} facts.Add(fact); } return(facts); }
async Task <bool> FetchSO(string code) { if (Connectivity.NetworkAccess == NetworkAccess.Internet) { RestSharp.RestClient client = new RestSharp.RestClient(); string path = "GetDocument"; client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath + path); { string str = $"GET?qrystr=ACCHISTL|6|{code}|102|" + GoodsRecieveingApp.MainPage.UserCode; var Request = new RestSharp.RestRequest(); Request.Resource = str; Request.Method = RestSharp.Method.GET; var cancellationTokenSource = new CancellationTokenSource(); var res = await client.ExecuteAsync(Request, cancellationTokenSource.Token); if (res.Content.ToString().Contains("DocNum")) { DataSet myds = new DataSet(); myds = Newtonsoft.Json.JsonConvert.DeserializeObject <DataSet>(res.Content); // if (await GoodsRecieveingApp.App.Database.GetHeader(myds.Tables[0].Rows[0]["OrderNumber"].ToString())==null){ foreach (DataRow row in myds.Tables[0].Rows) { try { var Doc = new DocLine(); Doc.DocNum = row["DocNum"].ToString(); Doc.SupplierCode = row["SupplierCode"].ToString(); Doc.SupplierName = row["SupplierName"].ToString(); Doc.ItemBarcode = row["ItemBarcode"].ToString(); Doc.ItemCode = row["ItemCode"].ToString(); Doc.ItemDesc = row["ItemDesc"].ToString(); Doc.ScanAccQty = 0; Doc.ScanRejQty = 0; Doc.ItemQty = Convert.ToInt32(row["ItemQty"].ToString().Trim()); await GoodsRecieveingApp.App.Database.Insert(Doc); supplier = Doc.SupplierName; } catch { return(false); } } if (!SOTextlbl.Contains(txfSOCodes.Text)) { SOTextlbl += txfSOCodes.Text + " - " + supplier + "\n"; } return(true); //} } } } return(false); }
private async void ButtonRejected_Clicked(object sender, EventArgs e) { try { DocLine dl = await App.Database.GetOneSpecificDocAsync(txfPOCode.Text.ToUpper()); await Navigation.PushAsync(new ScanRej(dl)); } catch { Vibration.Vibrate(); message.DisplayMessage("Could not Load PO", true); } }
public async Task<bool> restetQty(DocLine d) { List<DocLine> dls = await App.Database.GetSpecificDocsAsync(d.DocNum); foreach (DocLine docline in dls.Where(x => x.ItemCode == d.ItemCode && x.ItemQty == 0&&!x.GRN)) { await App.Database.Delete(docline); } List<DocLine> Orig = (await App.Database.GetSpecificDocsAsync(d.DocNum)).Where(x => x.ItemQty != 0&& x.ItemCode == d.ItemCode).ToList(); Orig.ForEach(a=>a.Balacnce=0); Orig.ForEach(a=>a.ScanRejQty=0); Orig.ForEach(a=>a.ScanAccQty=0); await App.Database.Update(Orig.FirstOrDefault()); return true; }
private async Task <bool> ResetItem(DocLine doc) { var ds = new DataSet(); try { var t1 = new DataTable(); DataRow row = null; t1.Columns.Add("DocNum"); t1.Columns.Add("ItemBarcode"); t1.Columns.Add("ScanAccQty"); t1.Columns.Add("Balance"); t1.Columns.Add("ScanRejQty"); t1.Columns.Add("PalletNumber"); t1.Columns.Add("GRV"); row = t1.NewRow(); row["DocNum"] = doc.DocNum; row["ItemBarcode"] = doc.ItemBarcode; row["ScanAccQty"] = 0; row["Balance"] = 0; row["ScanRejQty"] = 0; row["PalletNumber"] = doc.PalletNum; row["GRV"] = false; t1.Rows.Add(row); ds.Tables.Add(t1); string myds = Newtonsoft.Json.JsonConvert.SerializeObject(ds); RestSharp.RestClient client = new RestSharp.RestClient(); client.BaseUrl = new Uri(GoodsRecieveingApp.MainPage.APIPath); { var Request = new RestSharp.RestRequest("SaveDocLine", RestSharp.Method.POST); Request.RequestFormat = RestSharp.DataFormat.Json; Request.AddJsonBody(myds); var cancellationTokenSource = new CancellationTokenSource(); var res = await client.ExecuteAsync(Request, cancellationTokenSource.Token); if (res.IsSuccessful && res.Content.Contains("COMPLETE")) { return(true); } else { return(false); } } } catch (Exception) { } return(false); }
public async Task <IActionResult> Create([Bind("GoodId,DocHeadId,Price,Quantity,Id")] DocLine docLine) { if (ModelState.IsValid) { docLine.Id = Guid.NewGuid(); _context.Add(docLine); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DocHeadId"] = new SelectList(_context.Docs, "Id", "Id", docLine.DocHeadId); ViewData["GoodId"] = new SelectList(_context.Goods, "Id", "Id", docLine.GoodId); return(View(docLine)); }
private async void LstItems_ItemSelected(object sender, SelectedItemChangedEventArgs e) { DocLine dl = e.SelectedItem as DocLine; string output = await DisplayActionSheet("Confirm:- Reset QTY to zero?", "YES", "NO"); switch (output) { case "NO": break; case "YES": if (await restetQty(dl)) { PopData(); } break; } }
private async void lstItems_ItemSelected(object sender, SelectedItemChangedEventArgs e) { DocLine dl = e.SelectedItem as DocLine; string output = await DisplayActionSheet("Reset Qty to zero for this item on this pallet?", "YES", "NO"); switch (output) { case "NO": break; case "YES": await GoodsRecieveingApp.App.Database.DeleteAllWithItemWithFilter(dl); await RefreshList(); break; } }
/* * public static Client IboClientToClient(IBOClient3 sageClient) * { * Client client = new Client(); * client.SageCode = sageClient.CT_Num; * client.Siret = sageClient.CT_Siret; * client.CompanyName = sageClient.CT_Intitule; * client.LegalForm = sageClient.CT_Qualite; * client.CompanyEmail = sageClient.Telecom.EMail; * client.Portable = sageClient.Telecom.Portable; * client.CompanyFax = sageClient.Telecom.Telecopie; * client.CompanyMobile = sageClient.Telecom.Telephone; * client.MainAddress.MainAddress = sageClient.Adresse.Adresse; * client.MainAddress.AdressAdditional = sageClient.Adresse.Complement; * client.MainAddress.ZipCode = sageClient.Adresse.CodePostal; * client.MainAddress.City = sageClient.Adresse.Ville; * client.MainAddress.Country = sageClient.Adresse.Pays; * client.VatIdentifier = sageClient.CT_Identifiant; * return client; * }*/ public static Order IboOrderToOrder(IBODocumentVente3 orderHeader) { Order sageOrder = new Order(); try { sageOrder.DO_Piece = orderHeader.DO_Piece; sageOrder.DO_Ref = orderHeader.DO_Ref; sageOrder.DO_Statut = orderHeader.DO_Statut.ToString(); sageOrder.DO_Tiers = orderHeader.Tiers.CT_Num; sageOrder.CT_NumPayeur = orderHeader.TiersPayeur.CT_Num; sageOrder.DO_Date = orderHeader.DO_Date; sageOrder.DO_DateLivr = orderHeader.DO_DateLivr; sageOrder.DO_TotalHT = Convert.ToDecimal(orderHeader.DO_TotalHT); sageOrder.DO_TotalHTNet = Convert.ToDecimal(orderHeader.DO_TotalHTNet); sageOrder.DO_TotalTTC = Convert.ToDecimal(orderHeader.DO_TotalTTC); sageOrder.DO_NetAPayer = Convert.ToDecimal(orderHeader.DO_NetAPayer); sageOrder.DO_MontantRegle = Convert.ToDecimal(orderHeader.DO_MontantRegle); foreach (IBODocumentVenteLigne3 orderLine in orderHeader.FactoryDocumentLigne.List) { DocLine docLine = new DocLine(); docLine.AR_Ref = orderLine.Article.AR_Ref; docLine.DL_Design = orderLine.DL_Design; docLine.DL_MontantHT = Convert.ToDecimal(orderLine.DL_MontantHT); docLine.DL_MontantTTC = Convert.ToDecimal(orderLine.DL_MontantTTC); docLine.DL_PrixUnitaire = Convert.ToDecimal(orderLine.DL_PrixUnitaire); docLine.DL_PUTTC = Convert.ToDecimal(orderLine.DL_PUTTC); docLine.DL_Qte = orderLine.DL_Qte; //docLine.DL_Taxe1 = orderLine.Taxe.TA_GrilleTaxe.1 //docLine.DL_TypeTaxe1 = orderLine.Taxe.TA_Type; docLine.DO_Date = orderLine.DO_Date; docLine.DO_Domaine = Convert.ToByte(orderLine.DO_Domaine); docLine.DO_Piece = orderLine.DL_PieceBC; docLine.DO_Type = Convert.ToByte(orderLine.DO_Type); sageOrder.DocLines.Add(docLine); } return(sageOrder); } catch (Exception e) { return(sageOrder); } }
public UpdateMenuViewModel Parse(string fileName) { var document = new Document(fileName); var section = document.Sections[0]; var lines = new List <DocLine>(); foreach (Paragraph par in section.Paragraphs) { if (string.IsNullOrWhiteSpace(par.Text)) { continue; } var l = new DocLine() { Text = par.Text.Trim(), Number = lines.Count }; lines.Add(l); } var titleItem = lines.FirstOrDefault(IsTitle); var title = titleItem == null ? string.Empty : titleItem.Text; var date = titleItem == null ? DateTime.Now : title.ExtractDateFromTitle(); var priceItem = lines.FirstOrDefault(IsPrice); var price = priceItem == null ? 0 : priceItem.Text.ExtractPriceFromString(); lines.Remove(titleItem); lines.Remove(priceItem); lines.Remove(lines.FirstOrDefault(IsMenu)); List <MenuSectionViewModel> m = null; ExtractMenu(lines, ref m); var model = new UpdateMenuViewModel() { LunchDate = (date ?? DateTime.Now).ToString("YYYY-MM-DD"), Price = price, // Title = title, Sections = m, //FilePath = fileName }; return(model); }
private DocLine[] LoadLines(MIncomeTax tax) { List <DocLine> list = new List <DocLine>(); MIncomeTaxLines[] lines = tax.GetLines(false); for (int i = 0; i < lines.Length; i++) { MIncomeTaxLines line = lines[i]; DocLine docLine = new DocLine(line, this); //docLine.SetAmount(line.GetIncomeTaxAmount()); // list.Add(docLine); } // Return Array DocLine[] dls = new DocLine[list.Count]; dls = list.ToArray(); return(dls); }
public async void PopData() { lstItems.ItemsSource = null; List<DocLine> lines = await GoodsRecieveingApp.App.Database.GetSpecificDocsAsync(docCode); List<DocLine> list = new List<DocLine>(); foreach (string s in lines.Select(x => x.ItemCode).Distinct()) { foreach (int i in lines.Where(x=>x.ItemCode==s).Select(x => x.PalletNum).Distinct()) { int Pall = lines.Where(x => x.ItemCode == s && x.PalletNum == i).Select(x => x.PalletNum).FirstOrDefault(); string itemdesc = lines.Where(x => x.ItemCode == s && x.PalletNum == i).Select(x=>x.ItemDesc).FirstOrDefault(); DocLine TempDoc = new DocLine() {PalletNum= Pall, ItemDesc= itemdesc }; TempDoc.ScanAccQty = (lines.Where(x => x.ItemCode == s && x.PalletNum == i).Sum(x => x.ScanAccQty)); TempDoc.ItemQty = (lines.Where(x => x.ItemCode == s).First().ItemQty); TempDoc.Balacnce = TempDoc.ItemQty - TempDoc.ScanAccQty; if (i==0) { TempDoc.Complete = "Orig"; } else { if (TempDoc.Balacnce == 0) { TempDoc.Complete = "Yes"; } else if (TempDoc.ScanAccQty == 0) { TempDoc.Complete = "NotStarted"; } else { TempDoc.Complete = "No"; } } list.Add(TempDoc); } } //list.RemoveAll(x => x.ItemCode.Length < 2); //lstItems.ItemsSource = list.OrderBy(x => new { x.ItemDesc , x.PalletNum } ); lstItems.ItemsSource = list; }
/// <summary> /// Updates layout of node end of tree, adjusting tree segment as necessary /// </summary> /// <param name="docLine"></param> /// <param name="docDef"></param> public static void LayoutNode(DocLine docTree, DocLine docLine) { DocDefinition docDef = docLine.Definition; if (docLine.DiagramLine.Count >= 2) { while (docLine.DiagramLine.Count < 3) { docLine.DiagramLine.Insert(1, new DocPoint()); } // shortcut: make up a rectangle for the line -- don't use constructor as that will allocate as object to be serialized within current project DocRectangle fakeRectangle = (DocRectangle)System.Runtime.Serialization.FormatterServices.GetUninitializedObject(typeof(DocRectangle)); fakeRectangle.X = docTree.DiagramLine[docTree.DiagramLine.Count - 1].X; fakeRectangle.Y = docTree.DiagramLine[docTree.DiagramLine.Count - 1].Y; fakeRectangle.Width = 0; fakeRectangle.Height = 0; LayoutLine(fakeRectangle, docDef.DiagramRectangle, docLine.DiagramLine[0], docLine.DiagramLine[1], docLine.DiagramLine[2]); } }
async Task RefreshList() { lstItems.ItemsSource = null; List <DocLine> docs = (await GoodsRecieveingApp.App.Database.GetSpecificDocsAsync(txfSOCode.Text)).OrderBy(s => s.Bin).ToList(); if (docs == null) { return; } List <DocLine> displayDocs = new List <DocLine>(); foreach (string s in docs.Select(x => x.ItemDesc).Distinct()) { try { DocLine TempDoc = docs.Where(x => x.ItemDesc == s).First(); TempDoc.ScanAccQty = docs.Where(x => x.ItemDesc == s).Sum(x => x.ScanAccQty); TempDoc.ItemQty = (await GoodsRecieveingApp.App.Database.GetSpecificDocsAsync(txfSOCode.Text)).Where(x => x.PalletNum == 0 && x.ItemDesc == s).First().ItemQty; TempDoc.Balacnce = TempDoc.ItemQty - (await GoodsRecieveingApp.App.Database.GetSpecificDocsAsync(txfSOCode.Text)).Where(x => x.ItemDesc == s).Sum(x => x.ScanAccQty); displayDocs.Add(TempDoc); if (TempDoc.Balacnce == 0) { TempDoc.Complete = "Yes"; } else if (TempDoc.Balacnce != TempDoc.ItemQty) { TempDoc.Complete = "No"; } else { TempDoc.Complete = "NotStarted"; } } catch (Exception exes) { await DisplayAlert(exes + "", "", "OK"); } } lstItems.ItemsSource = displayDocs; }
async Task RefreshList() { try { lstItems.ItemsSource = null; List <DocLine> docs = (await GoodsRecieveingApp.App.Database.GetSpecificDocsAsync(txfSOCode.Text.ToUpper())).Where(x => x.PalletNum == currentPallet || x.ScanAccQty == 0).OrderBy(s => s.Bin).ToList(); if (docs == null) { return; } List <DocLine> displayDocs = new List <DocLine>(); foreach (string s in docs.Select(x => x.ItemDesc).Distinct()) { DocLine TempDoc = (await GoodsRecieveingApp.App.Database.GetSpecificDocsAsync(txfSOCode.Text.ToUpper())).Where(x => x.ItemDesc == s).First(); TempDoc.ScanAccQty = docs.Where(x => x.ItemDesc == s).Sum(x => x.ScanAccQty); TempDoc.ItemQty = (await GoodsRecieveingApp.App.Database.GetSpecificDocsAsync(txfSOCode.Text.ToUpper())).Where(x => x.ItemDesc == s).First().ItemQty; TempDoc.PalletNum = currentPallet; TempDoc.Balacnce = TempDoc.ItemQty - (await GoodsRecieveingApp.App.Database.GetSpecificDocsAsync(txfSOCode.Text.ToUpper())).Where(x => x.ItemDesc == s).Sum(x => x.ScanAccQty); if (TempDoc.Balacnce == 0) { TempDoc.Complete = "Yes"; } else if (TempDoc.Balacnce != TempDoc.ItemQty) { TempDoc.Complete = "No"; } else { TempDoc.Complete = "NotStarted"; } displayDocs.Add(TempDoc); } lstItems.ItemsSource = displayDocs; } catch (Exception ec) { Vibration.Vibrate(); message.DisplayMessage("Could not load SO" + ec, true); } }
/// <summary> /// Create Facts (the accounting logic) for /// </summary> /// <param name="?"></param> /// <returns>Fact</returns> public override List <Fact> CreateFacts(MAcctSchema as1) { // create Fact Header List <Fact> facts = new List <Fact>(); if (GetDocumentType().Equals(MDocBaseType.DOCBASETYPE_INCOMETAX)) { // Decimal grossAmt = getAmount(Doc.AMTTYPE_Gross); // Commitment Fact fact = new Fact(this, as1, Fact.POST_Actual); Decimal total = Env.ZERO; Decimal amount = Env.ZERO; for (int i = 0; i < _lines.Length; i++) { DocLine dline = _lines[i]; MIncomeTaxLines line = new MIncomeTaxLines(GetCtx(), dline.Get_ID(), null); amount = Util.GetValueOfDecimal(line.GetIncomeTaxAmount()); if (amount != Env.ZERO) { total = Decimal.Add(total, amount); } // Account MAccount expense = MAccount.Get(GetCtx(), line.GetC_IncomeTax_Acct()); fact.CreateLine(dline, expense, GetC_Currency_ID(), amount); } if (total != Env.ZERO) { int validComID = Util.GetValueOfInt(DB.ExecuteScalar(@"SELECT T_Due_Acct FROM C_Tax_Acct WHERE C_AcctSchema_ID=" + as1.GetC_AcctSchema_ID() + " AND AD_Client_ID = " + GetAD_Client_ID())); MAccount acct = MAccount.Get(GetCtx(), validComID); fact.CreateLine(null, acct, GetC_Currency_ID(), Decimal.Negate(total)); } facts.Add(fact); } return(facts); }
private void DrawObjectBorder(Graphics g, SEntity obj, Pen pen) { if (obj is DocDefinition && ((DocDefinition)obj).DiagramRectangle != null) { DocRectangle docRect = ((DocDefinition)obj).DiagramRectangle; Rectangle rc = new Rectangle( (int)(docRect.X * Factor), (int)(docRect.Y * Factor), (int)(docRect.Width * Factor), (int)(docRect.Height * Factor)); rc.Inflate(-2, -2); g.DrawRectangle(pen, rc); } else if (obj is DocAttribute) { DocAttribute docAttr = (DocAttribute)obj; if (docAttr.DiagramLine != null) { for (int i = 0; i < docAttr.DiagramLine.Count - 1; i++) { g.DrawLine(pen, new Point((int)(docAttr.DiagramLine[i].X * Factor), (int)(docAttr.DiagramLine[i].Y * Factor)), new Point((int)(docAttr.DiagramLine[i + 1].X * Factor), (int)(docAttr.DiagramLine[i + 1].Y * Factor))); } } } else if (obj is DocLine) { // tree point DocLine docLine = (DocLine)obj; DocPoint docPoint = docLine.DiagramLine[docLine.DiagramLine.Count - 1]; Rectangle rc = new Rectangle((int)(docPoint.X * Factor), (int)(docPoint.Y * Factor), 0, 0); rc.Inflate(6, 6); g.DrawEllipse(pen, rc); } }
private DocLine[] LoadLines(MIncomeTax tax) { List <DocLine> list = new List <DocLine>(); MIncomeTaxLines[] lines = tax.GetLines(false); for (int i = 0; i < lines.Length; i++) { MIncomeTaxLines line = lines[i]; DocLine docLine = new DocLine(line, this); //docLine.SetAmount(line.GetIncomeTaxAmount()); // set primary key value docLine.SetPrimaryKeyValue(line.GetC_IncomeTaxLines_ID()); // set GL journal line table ID docLine.SetLineTable_ID(line.Get_Table_ID()); // list.Add(docLine); } // Return Array DocLine[] dls = new DocLine[list.Count]; dls = list.ToArray(); return(dls); }
private static void DrawTree(Graphics g, DocLine docSub, double factor, Point ptLast) { Point ptNext = Point.Empty; if (docSub.DiagramLine != null) { using (Pen pen = new Pen(Color.Black, 3.0f)) { for (int i = 0; i < docSub.DiagramLine.Count - 1; i++) { Point ptA = new Point((int)(docSub.DiagramLine[i].X * factor), (int)(docSub.DiagramLine[i].Y * factor)); Point ptB = new Point((int)(docSub.DiagramLine[i].X * factor), (int)(docSub.DiagramLine[i + 1].Y * factor)); Point ptC = new Point((int)(docSub.DiagramLine[i + 1].X * factor), (int)(docSub.DiagramLine[i + 1].Y * factor)); if (i == 0 && ptLast != Point.Empty) { g.DrawLine(pen, ptLast, ptA); } ptNext = ptC; g.DrawLine(pen, ptA, ptB); g.DrawLine(pen, ptB, ptC); } } } foreach (DocLine docInner in docSub.Tree) { DrawTree(g, docInner, factor, ptNext); } }
/// <summary> /// Finds object at absolute point (regardless of scroll position or page) /// </summary> /// <param name="pt"></param> /// <returns></returns> private DocObject Pick(Point pt, out DocLine line, out ResizeHandle handle) { line = null; handle = ResizeHandle.None; if (this.m_schema == null) return null; pt.X -= this.AutoScrollPosition.X; pt.Y -= this.AutoScrollPosition.Y; PointF ptFloat = new PointF(pt.X, pt.Y); foreach(DocType docType in this.m_schema.Types) { if (HitTest(docType.DiagramRectangle, pt, out handle)) return docType; if(docType is DocSelect) { DocSelect docSel = (DocSelect)docType; foreach (DocLine docLine in docSel.Tree) { DocPoint docPoint = docLine.DiagramLine[docLine.DiagramLine.Count - 1]; PointF ptA = new PointF((float)(docPoint.X * Factor), (float)docPoint.Y * Factor); if (Math.Abs(ptFloat.X - ptA.X) < 4 && Math.Abs(ptFloat.Y - ptA.Y) <= 5) { handle = ResizeHandle.Move; line = docLine; return docType; } } } } foreach (DocEntity docType in this.m_schema.Entities) { if (HitTest(docType.DiagramRectangle, pt, out handle)) return docType; foreach(DocAttribute docAttr in docType.Attributes) { if (docAttr.DiagramLine != null) { for(int i = 0; i < docAttr.DiagramLine.Count-1; i++) { PointF ptA = new PointF((float)(docAttr.DiagramLine[i].X * Factor), (float)docAttr.DiagramLine[i].Y * Factor); PointF ptB = new PointF((float)(docAttr.DiagramLine[i+1].X * Factor), (float)docAttr.DiagramLine[i+1].Y * Factor); PointF ptClosest = new PointF(); double distance = FindDistanceToSegment(ptFloat, ptA, ptB, out ptClosest); if(distance < 3.0) { return docAttr; } } } } foreach(DocLine docLine in docType.Tree) { if (docLine.DiagramLine.Count > 0) { DocPoint docPoint = docLine.DiagramLine[docLine.DiagramLine.Count - 1]; PointF ptA = new PointF((float)(docPoint.X * Factor), (float)docPoint.Y * Factor); if (Math.Abs(ptFloat.X - ptA.X) < 4 && Math.Abs(ptFloat.Y - ptA.Y) <= 5) { line = docLine; handle = ResizeHandle.Move; return docType; } } } } foreach (DocComment docType in this.m_schema.Comments) { if (HitTest(docType.DiagramRectangle, pt, out handle)) return docType; } foreach (DocPageTarget docType in this.m_schema.PageTargets) { if (HitTest(docType.DiagramRectangle, pt, out handle)) return docType; foreach(DocPageSource docSource in docType.Sources) { if (HitTest(docSource.DiagramRectangle, pt, out handle)) return docSource; } } foreach (DocPrimitive docType in this.m_schema.Primitives) { if (HitTest(docType.DiagramRectangle, pt, out handle)) return docType; } foreach (DocSchemaRef docSchemaRef in this.m_schema.SchemaRefs) { foreach (DocDefinitionRef docType in docSchemaRef.Definitions) { if (HitTest(docType.DiagramRectangle, pt, out handle)) return docType; foreach (DocLine docLine in docType.Tree) { DocPoint docPoint = docLine.DiagramLine[docLine.DiagramLine.Count - 1]; PointF ptA = new PointF((float)(docPoint.X * Factor), (float)docPoint.Y * Factor); if (Math.Abs(ptFloat.X - ptA.X) < 4 && Math.Abs(ptFloat.Y - ptA.Y) <= 5) { handle = ResizeHandle.Move; line = docLine; return docType; } } } } return null; }
/// <summary> /// Updates layout of parent end of tree /// </summary> /// <param name="defA"></param> /// <param name="docLine"></param> public static void LayoutTree(DocDefinition defA, DocLine docLine) { if(docLine.Definition != null) { LayoutLine(defA, docLine.Definition, docLine.DiagramLine); } else if(docLine.DiagramLine.Count >= 2) { while (docLine.DiagramLine.Count < 3) { docLine.DiagramLine.Insert(1, new DocPoint()); } // shortcut: make up a rectangle for the line -- don't use constructor as that will allocate as object to be serialized within current project DocRectangle fakeRectangle = (DocRectangle)System.Runtime.Serialization.FormatterServices.GetUninitializedObject(typeof(DocRectangle)); fakeRectangle.X = docLine.DiagramLine[docLine.DiagramLine.Count-1].X; fakeRectangle.Y = docLine.DiagramLine[docLine.DiagramLine.Count - 1].Y; fakeRectangle.Width = 0; fakeRectangle.Height = 0; LayoutLine(defA.DiagramRectangle, fakeRectangle, docLine.DiagramLine[0], docLine.DiagramLine[1], docLine.DiagramLine[2]); } }
private void ctlExpressG_LinkOperation(object sender, EventArgs e) { if (this.ctlExpressG.Highlight is DocDefinition) { DocDefinition docDefinition = (DocDefinition)this.ctlExpressG.Highlight; if(e == null && docDefinition is DocEntity) { DocEntity docEntity = (DocEntity)docDefinition; // link subtype (either from entity or entity reference) docEntity.BaseDefinition = this.ctlExpressG.Selection.Name; DocLine docLine = new DocLine(); docLine.DiagramLine.Add(new DocPoint()); docLine.DiagramLine.Add(new DocPoint()); docLine.DiagramLine.Add(new DocPoint()); docLine.Definition = docDefinition; List<DocLine> tree = null; if (this.ctlExpressG.Selection is DocEntity) { DocEntity docSuper = (DocEntity)this.ctlExpressG.Selection; DocSubtype docSub = new DocSubtype(); docSub.DefinedType = docEntity.Name; docSuper.Subtypes.Add(docSub); tree = docSuper.Tree; } else if (this.ctlExpressG.Selection is DocDefinitionRef) { tree = ((DocDefinitionRef)this.ctlExpressG.Selection).Tree; } if(tree != null) { if (tree.Count > 0 && tree[0].Definition == null) { // existing tree structure tree[0].Tree.Add(docLine); } else { // no tree structure tree.Add(docLine); } } this.ctlExpressG.LayoutDefinition((DocDefinition)this.ctlExpressG.Selection); this.ctlExpressG.LayoutDefinition(docDefinition); this.ctlExpressG.Redraw(); } else if (this.ctlExpressG.Selection is DocEntity) { // create an attribute DocEntity docEntity = (DocEntity)this.ctlExpressG.Selection; DocAttribute docAttr = new DocAttribute(); docAttr.Name = "Attribute"; docAttr.Definition = docDefinition; docAttr.DefinedType = docAttr.Definition.Name; CtlExpressG.LayoutLine(docEntity, docAttr.Definition, docAttr.DiagramLine); docAttr.DiagramLabel = new DocRectangle(); docAttr.DiagramLabel.X = docAttr.DiagramLine[0].X; docAttr.DiagramLabel.Y = docAttr.DiagramLine[0].Y; docAttr.DiagramLabel.Width = 400.0; docAttr.DiagramLabel.Height = 100.0; docEntity.Attributes.Add(docAttr); TreeNode tnParent = this.treeView.SelectedNode; this.treeView.SelectedNode = this.LoadNode(tnParent, docAttr, docAttr.ToString(), false); toolStripMenuItemEditRename_Click(this, e); } else if (this.ctlExpressG.Selection is DocSelect) { // link select DocSelect docSelect = (DocSelect)this.ctlExpressG.Selection; // link definition DocSelectItem docItem = new DocSelectItem(); //docItem.Definition = docDefinition; docItem.Name = docDefinition.Name; //CtlExpressG.LayoutLine(docSelect, docItem.Definition, docItem.DiagramLine); docSelect.Selects.Add(docItem); // link lines DocLine docLine = new DocLine(); docLine.Definition = docDefinition; CtlExpressG.LayoutLine(docSelect, docDefinition, docLine.DiagramLine); docSelect.Tree.Add(docLine); TreeNode tnParent = this.treeView.SelectedNode; this.treeView.SelectedNode = this.LoadNode(tnParent, docItem, docItem.ToString(), false); } else if (this.ctlExpressG.Selection is DocDefined) { // link defined DocDefined docDefined = (DocDefined)this.ctlExpressG.Selection; docDefined.Definition = docDefinition; docDefined.DefinedType = docDefined.Definition.Name; CtlExpressG.LayoutLine(docDefined, docDefined.Definition, docDefined.DiagramLine); } } }
private void toolStripMenuItemDiagramFormatTree_Click(object sender, EventArgs e) { IDocTreeHost docDefinition = (IDocTreeHost)this.treeView.SelectedNode.Tag; List<DocLine> list = docDefinition.Tree; // add/remove tree if (list != null) { if (list.Count > 0 && list[0].Definition == null) { // remove tree(s) for (int iTree = list.Count - 1; iTree >= 0; iTree--) { DocLine docTree = list[0]; for(int iNode = docTree.Tree.Count-1; iNode >= 0; iNode--) { DocLine docNode = docTree.Tree[iNode]; docTree.Tree.RemoveAt(iNode); list.Add(docNode); } list.RemoveAt(iTree); docTree.Delete(); } this.ctlExpressG.LayoutDefinition((DocDefinition)docDefinition); } else if(list.Count > 0) { // add tree -- make node half-way along first link // clean up any page refs for(int i = 0; i < list.Count; i++) { if(list[i].Definition is DocPageSource) { DocPageSource docPageSource = (DocPageSource)list[i].Definition; // does page source still exist bool exists = false; foreach(DocPageTarget docPageTarget in this.ctlExpressG.Schema.PageTargets) { if(docPageTarget.Sources.Contains(docPageSource)) { exists = true; break; } } if(!exists) { string[] parts = docPageSource.Name.Split(); if (parts.Length == 2) { DocDefinition docDef = this.ctlExpressG.Schema.GetDefinition(parts[1]); if (docDef != null) { list[i].Definition.Delete(); list[i].Definition = docDef; } } } } } DocLine docNode = list[0]; DocPoint docPos = new DocPoint( (docNode.DiagramLine[0].X + docNode.DiagramLine[docNode.DiagramLine.Count - 1].X) * 0.5, (docNode.DiagramLine[0].Y + docNode.DiagramLine[docNode.DiagramLine.Count - 1].Y) * 0.5); DocLine docTree = new DocLine(); docTree.DiagramLine.Add(new DocPoint()); // will get positioned upon layout docTree.DiagramLine.Add(new DocPoint()); // will get positioned upon layout docTree.DiagramLine.Add(docPos); for(int iNode = list.Count-1; iNode >= 0; iNode--) { docTree.Tree.Add(list[iNode]); list.RemoveAt(iNode); } list.Add(docTree); this.ctlExpressG.LayoutDefinition((DocDefinition)docDefinition); foreach(DocLine docLine in docTree.Tree) { this.ctlExpressG.LayoutDefinition(docLine.Definition); } } } this.ctlExpressG.Redraw(); }
/// <summary> /// Creates a documentation schema from a VEX schema /// </summary> /// <param name="schemata">The VEX schema to import</param> /// <param name="project">The documentation project where the imported schema is to be created</param> /// <returns>The imported documentation schema</returns> internal static DocSchema ImportVex(SCHEMATA schemata, DocProject docProject, bool updateDescriptions) { DocSchema docSchema = docProject.RegisterSchema(schemata.name); if (updateDescriptions && schemata.comment != null && schemata.comment.text != null) { docSchema.Documentation = schemata.comment.text.text; } docSchema.DiagramPagesHorz = schemata.settings.page.nhorizontalpages; docSchema.DiagramPagesVert = schemata.settings.page.nverticalpages; // remember current types for deletion if they no longer exist List<DocObject> existing = new List<DocObject>(); foreach (DocType doctype in docSchema.Types) { existing.Add(doctype); } foreach (DocEntity docentity in docSchema.Entities) { existing.Add(docentity); } foreach (DocFunction docfunction in docSchema.Functions) { existing.Add(docfunction); } foreach (DocGlobalRule docrule in docSchema.GlobalRules) { existing.Add(docrule); } docSchema.PageTargets.Clear(); docSchema.SchemaRefs.Clear(); docSchema.Comments.Clear(); // remember references for fixing up attributes afterwords Dictionary<object, DocDefinition> mapRefs = new Dictionary<object, DocDefinition>(); Dictionary<ATTRIBUTE_DEF, DocAttribute> mapAtts = new Dictionary<ATTRIBUTE_DEF, DocAttribute>(); //Dictionary<SELECT_DEF, DocSelectItem> mapSels = new Dictionary<SELECT_DEF, DocSelectItem>(); Dictionary<SELECT_DEF, DocLine> mapSL = new Dictionary<SELECT_DEF, DocLine>(); Dictionary<SUBTYPE_DEF, DocLine> mapSubs = new Dictionary<SUBTYPE_DEF, DocLine>(); Dictionary<PAGE_REF, DocPageTarget> mapPage = new Dictionary<PAGE_REF, DocPageTarget>(); // entities and types foreach (object obj in schemata.objects) { if (obj is ENTITIES) { ENTITIES ent = (ENTITIES)obj; // filter out orphaned entities having upper flags set if ((ent.flag & 0xFFFF0000) == 0 && (ent.interfaceto == null || ent.interfaceto.theschema == null)) { // create if doesn't exist string name = ent.name.text; string super = null; if (ent.supertypes.Count > 0 && ent.supertypes[0].the_supertype is ENTITIES) { ENTITIES superent = (ENTITIES)ent.supertypes[0].the_supertype; super = superent.name.text; } DocEntity docEntity = docSchema.RegisterEntity(name); if (existing.Contains(docEntity)) { existing.Remove(docEntity); } mapRefs.Add(obj, docEntity); // clear out existing if merging docEntity.BaseDefinition = null; foreach(DocSubtype docSub in docEntity.Subtypes) { docSub.Delete(); } docEntity.Subtypes.Clear(); foreach(DocUniqueRule docUniq in docEntity.UniqueRules) { docUniq.Delete(); } docEntity.UniqueRules.Clear(); foreach(DocLine docLine in docEntity.Tree) { docLine.Delete(); } docEntity.Tree.Clear(); if (updateDescriptions && ent.comment != null && ent.comment.text != null) { docEntity.Documentation = ent.comment.text.text; } if (ent.supertypes.Count > 0 && ent.supertypes[0].the_supertype is ENTITIES) { docEntity.BaseDefinition = ((ENTITIES)ent.supertypes[0].the_supertype).name.text; } docEntity.EntityFlags = ent.flag; if (ent.subtypes != null) { foreach (SUBTYPE_DEF sd in ent.subtypes) { // new (3.8): intermediate subtypes for diagrams DocLine docLine = new DocLine(); ImportVexLine(sd.layout, null, docLine.DiagramLine, null); docEntity.Tree.Add(docLine); OBJECT od = (OBJECT)sd.the_subtype; // tunnel through page ref if (od is PAGE_REF_TO) { od = ((PAGE_REF_TO)od).pageref; } if (od is TREE) { TREE tree = (TREE)od; foreach (OBJECT o in tree.list) { OBJECT os = o; OBJECT_LINE_LAYOUT linelayout = null; if (o is SUBTYPE_DEF) { SUBTYPE_DEF osd = (SUBTYPE_DEF)o; linelayout = osd.layout; os = ((SUBTYPE_DEF)o).the_subtype; } if (os is PAGE_REF_TO) { os = ((PAGE_REF_TO)os).pageref; } if (os is ENTITIES) { DocSubtype docSub = new DocSubtype(); docSub.DefinedType = ((ENTITIES)os).name.text; docEntity.Subtypes.Add(docSub); DocLine docSubline = new DocLine(); docLine.Tree.Add(docSubline); if (o is SUBTYPE_DEF) { mapSubs.Add((SUBTYPE_DEF)o, docSubline); } ImportVexLine(linelayout, null, docSubline.DiagramLine, null); } else { Debug.Assert(false); } } } else if (od is ENTITIES) { DocSubtype docInt = new DocSubtype(); docEntity.Subtypes.Add(docInt); docInt.DefinedType = ((ENTITIES)od).name.text; } else { Debug.Assert(false); } } } // determine EXPRESS-G page based on placement (required for generating hyperlinks) if (ent.layout != null) { ImportVexRectangle(docEntity, ent.layout.rectangle, schemata); } if (ent.attributes != null) { List<DocAttribute> existingattr = new List<DocAttribute>(); foreach (DocAttribute docAttr in docEntity.Attributes) { existingattr.Add(docAttr); } // attributes are replaced, not merged (template don't apply here) foreach (ATTRIBUTE_DEF attr in ent.attributes) { if (attr.name != null) { DocAttribute docAttr = docEntity.RegisterAttribute(attr.name.text); mapAtts.Add(attr, docAttr); if (existingattr.Contains(docAttr)) { existingattr.Remove(docAttr); } if (updateDescriptions && attr.comment != null && attr.comment.text != null) { docAttr.Documentation = attr.comment.text.text; } if (docAttr.DiagramLabel != null) { docAttr.DiagramLabel.Delete(); docAttr.DiagramLabel = null; } foreach(DocPoint docPoint in docAttr.DiagramLine) { docPoint.Delete(); } docAttr.DiagramLine.Clear(); if (attr.layout != null) { if (attr.layout.pline != null) { // intermediate lines if (attr.layout.pline.rpoint != null) { docAttr.DiagramLabel = new DocRectangle(); ImportVexLine(attr.layout, attr.name.layout, docAttr.DiagramLine, docAttr.DiagramLabel); } } } OBJECT def = attr.the_attribute; if (attr.the_attribute is PAGE_REF_TO) { PAGE_REF_TO pr = (PAGE_REF_TO)attr.the_attribute; def = pr.pageref; } if (def is DEFINED_TYPE) { DEFINED_TYPE dt = (DEFINED_TYPE)def; docAttr.DefinedType = dt.name.text; } else if (def is ENTITIES) { ENTITIES en = (ENTITIES)def; docAttr.DefinedType = en.name.text; } else if (def is ENUMERATIONS) { ENUMERATIONS en = (ENUMERATIONS)def; docAttr.DefinedType = en.name.text; } else if (def is SELECTS) { SELECTS en = (SELECTS)def; docAttr.DefinedType = en.name.text; } else if (def is PRIMITIVE_TYPE) { PRIMITIVE_TYPE en = (PRIMITIVE_TYPE)def; string length = ""; if (en.constraints > 0) { length = " (" + en.constraints.ToString() + ")"; } else if (en.constraints < 0) { int len = -en.constraints; length = " (" + len.ToString() + ") FIXED"; } docAttr.DefinedType = en.name.text + length; } else if (def is SCHEMA_REF) { SCHEMA_REF en = (SCHEMA_REF)def; docAttr.DefinedType = en.name.text; } else { Debug.Assert(false); } docAttr.AttributeFlags = attr.attributeflag; AGGREGATES vexAggregates = attr.aggregates; DocAttribute docAggregate = docAttr; while (vexAggregates != null) { // traverse nested aggregation (e.g. IfcStructuralLoadConfiguration) docAggregate.AggregationType = vexAggregates.aggrtype + 1; docAggregate.AggregationLower = vexAggregates.lower; docAggregate.AggregationUpper = vexAggregates.upper; docAggregate.AggregationFlag = vexAggregates.flag; vexAggregates = vexAggregates.next; if (vexAggregates != null) { // inner array (e.g. IfcStructuralLoadConfiguration) docAggregate.AggregationAttribute = new DocAttribute(); docAggregate = docAggregate.AggregationAttribute; } } docAttr.Derived = attr.is_derived; if (attr.user_redeclaration != null) { docAttr.Inverse = attr.user_redeclaration; } else if (attr.is_inverse is ATTRIBUTE_DEF) { ATTRIBUTE_DEF adef = (ATTRIBUTE_DEF)attr.is_inverse; docAttr.Inverse = adef.name.text; } else if (attr.is_inverse != null) { Debug.Assert(false); } } } foreach(DocAttribute docAttr in existingattr) { docEntity.Attributes.Remove(docAttr); docAttr.Delete(); } } // unique rules if (ent.uniquenes != null) { // rules are replaced, not merged (template don't apply here) //docEntity.UniqueRules = new List<DocUniqueRule>(); foreach (UNIQUE_RULE rule in ent.uniquenes) { DocUniqueRule docRule = new DocUniqueRule(); docEntity.UniqueRules.Add(docRule); docRule.Name = rule.name; docRule.Items = new List<DocUniqueRuleItem>(); foreach (ATTRIBUTE_DEF ruleitem in rule.for_attribute) { DocUniqueRuleItem item = new DocUniqueRuleItem(); item.Name = ruleitem.name.text; docRule.Items.Add(item); } } } // where rules if (ent.wheres != null) { List<DocWhereRule> existingattr = new List<DocWhereRule>(); foreach (DocWhereRule docWhere in docEntity.WhereRules) { existingattr.Add(docWhere); } foreach (WHERE_RULE where in ent.wheres) { DocWhereRule docWhere = docEntity.RegisterWhereRule(where.name); docWhere.Expression = where.rule_context; if(existingattr.Contains(docWhere)) { existingattr.Remove(docWhere); } if (updateDescriptions && where.comment != null && where.comment.text != null) { docWhere.Documentation = where.comment.text.text; } } foreach(DocWhereRule exist in existingattr) { exist.Delete(); docEntity.WhereRules.Remove(exist); } } } } else if (obj is ENUMERATIONS) { ENUMERATIONS ent = (ENUMERATIONS)obj; if (ent.interfaceto == null || ent.interfaceto.theschema == null) { if (schemata.name.Equals("IfcConstructionMgmtDomain", StringComparison.OrdinalIgnoreCase) && ent.name.text.Equals("IfcNullStyle", StringComparison.OrdinalIgnoreCase)) { // hack to workaround vex bug Debug.Assert(true); } else { DocEnumeration docEnumeration = docSchema.RegisterType<DocEnumeration>(ent.name.text); if (existing.Contains(docEnumeration)) { existing.Remove(docEnumeration); } mapRefs.Add(obj, docEnumeration); if (updateDescriptions && ent.comment != null && ent.comment.text != null) { docEnumeration.Documentation = ent.comment.text.text; } // determine EXPRESS-G page based on placement (required for generating hyperlinks) if (ent.typelayout != null && schemata.settings != null && schemata.settings.page != null) { ImportVexRectangle(docEnumeration, ent.typelayout.rectangle, schemata); } // enumeration values are replaced, not merged (template don't apply here) docEnumeration.Constants.Clear(); foreach (string s in ent.enums) { DocConstant docConstant = new DocConstant(); docEnumeration.Constants.Add(docConstant); docConstant.Name = s; } } } } else if (obj is DEFINED_TYPE) { DEFINED_TYPE ent = (DEFINED_TYPE)obj; if (ent.interfaceto == null || ent.interfaceto.theschema == null) { DocDefined docDefined = docSchema.RegisterType<DocDefined>(ent.name.text); if (existing.Contains(docDefined)) { existing.Remove(docDefined); } mapRefs.Add(obj, docDefined); if (updateDescriptions && ent.comment != null && ent.comment.text != null) { docDefined.Documentation = ent.comment.text.text; } if (ent.layout != null) { ImportVexRectangle(docDefined, ent.layout.rectangle, schemata); } if(ent.defined.object_line_layout != null) { foreach(DocPoint docPoint in docDefined.DiagramLine) { docPoint.Delete(); } docDefined.DiagramLine.Clear(); ImportVexLine(ent.defined.object_line_layout, null, docDefined.DiagramLine, null); } OBJECT os = (OBJECT)ent.defined.defined; if (os is PAGE_REF_TO) { os = ((PAGE_REF_TO)os).pageref; } if (os is PRIMITIVE_TYPE) { PRIMITIVE_TYPE pt = (PRIMITIVE_TYPE)os; docDefined.DefinedType = pt.name.text; if (pt.constraints != 0) { docDefined.Length = pt.constraints; } } else if (os is DEFINED_TYPE) { DEFINED_TYPE dt = (DEFINED_TYPE)os; docDefined.DefinedType = dt.name.text; } else if (os is ENTITIES) { ENTITIES et = (ENTITIES)os; docDefined.DefinedType = et.name.text; } else { Debug.Assert(false); } // aggregation AGGREGATES vexAggregates = ent.defined.aggregates; if (vexAggregates != null) { DocAttribute docAggregate = new DocAttribute(); docDefined.Aggregation = docAggregate; docAggregate.AggregationType = vexAggregates.aggrtype + 1; docAggregate.AggregationLower = vexAggregates.lower; docAggregate.AggregationUpper = vexAggregates.upper; docAggregate.AggregationFlag = vexAggregates.flag; } // where rules if (ent.whererules != null) { // rules are replaced, not merged (template don't apply here) foreach(DocWhereRule docWhere in docDefined.WhereRules) { docWhere.Delete(); } docDefined.WhereRules.Clear(); foreach (WHERE_RULE where in ent.whererules) { DocWhereRule docWhere = new DocWhereRule(); docDefined.WhereRules.Add(docWhere); docWhere.Name = where.name; docWhere.Expression = where.rule_context; if (where.comment != null && where.comment.text != null) { docWhere.Documentation = where.comment.text.text; } } } } } else if (obj is SELECTS) { SELECTS ent = (SELECTS)obj; if (ent.interfaceto == null || ent.interfaceto.theschema == null) { DocSelect docSelect = docSchema.RegisterType<DocSelect>(ent.name.text); if (existing.Contains(docSelect)) { existing.Remove(docSelect); } mapRefs.Add(obj, docSelect); if (updateDescriptions && ent.comment != null && ent.comment.text != null) { docSelect.Documentation = ent.comment.text.text; } // determine EXPRESS-G page based on placement (required for generating hyperlinks) if (ent.typelayout != null) { ImportVexRectangle(docSelect, ent.typelayout.rectangle, schemata); } docSelect.Selects.Clear(); docSelect.Tree.Clear(); foreach (SELECT_DEF sdef in ent.selects) { DocLine docLine = new DocLine(); docSelect.Tree.Add(docLine); ImportVexLine(sdef.layout, null, docLine.DiagramLine, null); mapSL.Add(sdef, docLine); if (sdef.def is TREE) { TREE tree = (TREE)sdef.def; foreach (OBJECT o in tree.list) { DocSelectItem dsi = new DocSelectItem(); docSelect.Selects.Add(dsi); OBJECT os = o; if (o is SELECT_DEF) { SELECT_DEF selectdef = (SELECT_DEF)o; DocLine docLineSub = new DocLine(); docLine.Tree.Add(docLineSub); ImportVexLine(selectdef.layout, null, docLineSub.DiagramLine, null); mapSL.Add(selectdef, docLineSub); os = ((SELECT_DEF)o).def; } else { Debug.Assert(false); } if (os is PAGE_REF_TO) { PAGE_REF_TO pr = (PAGE_REF_TO)os; os = pr.pageref; } if (os is DEFINITION) { dsi.Name = ((DEFINITION)os).name.text; } } } else { OBJECT os = (OBJECT)sdef.def; if (os is PAGE_REF_TO) { PAGE_REF_TO pr = (PAGE_REF_TO)os; os = pr.pageref; } DocSelectItem dsi = new DocSelectItem(); docSelect.Selects.Add(dsi); if (os is DEFINITION) { dsi.Name = ((DEFINITION)os).name.text; } } } } } else if (obj is GLOBAL_RULE) { GLOBAL_RULE func = (GLOBAL_RULE)obj; DocGlobalRule docFunction = docSchema.RegisterRule(func.name); if (existing.Contains(docFunction)) { existing.Remove(docFunction); } // clear out existing if merging docFunction.WhereRules.Clear(); if (updateDescriptions && func.comment != null && func.comment.text != null) { docFunction.Documentation = func.comment.text.text; } docFunction.Expression = func.rule_context; foreach (WHERE_RULE wr in func.where_rule) { DocWhereRule docW = new DocWhereRule(); docW.Name = wr.name; docW.Expression = wr.rule_context; if (wr.comment != null) { docW.Documentation = wr.comment.text.text; } docFunction.WhereRules.Add(docW); } if (func.for_entities.Count == 1) { docFunction.ApplicableEntity = func.for_entities[0].ToString(); } } else if (obj is USER_FUNCTION) { USER_FUNCTION func = (USER_FUNCTION)obj; DocFunction docFunction = docSchema.RegisterFunction(func.name); if (existing.Contains(docFunction)) { existing.Remove(docFunction); } if (updateDescriptions && func.comment != null && func.comment.text != null) { docFunction.Documentation = func.comment.text.text; } docFunction.Expression = func.rule_context; // NOTE: While the VEX schema can represent parameters and return values, Visual Express does not implement it! // Rather, parameter info is also included in the 'rule_context' if (func.return_value != null) { docFunction.ReturnValue = func.return_value.ToString(); } else { docFunction.ReturnValue = null; } docFunction.Parameters.Clear(); if (func.parameter_list != null) { foreach (PARAMETER par in func.parameter_list) { DocParameter docParameter = new DocParameter(); docParameter.Name = par.name; docParameter.DefinedType = par.parameter_type.ToString(); docFunction.Parameters.Add(docParameter); } } } else if (obj is PRIMITIVE_TYPE) { PRIMITIVE_TYPE prim = (PRIMITIVE_TYPE)obj; DocPrimitive docPrimitive = new DocPrimitive(); docPrimitive.Name = prim.name.text; if (prim.layout != null) { ImportVexRectangle(docPrimitive, prim.layout.rectangle, schemata); } docSchema.Primitives.Add(docPrimitive); mapRefs.Add(obj, docPrimitive); } else if (obj is COMMENT) { COMMENT comment = (COMMENT)obj; // only deal with comments that are part of EXPRESS-G layout -- ignore those referenced by definitions and old cruft left behind due to older versions of VisualE that were buggy if (comment.layout != null) { DocComment docComment = new DocComment(); docComment.Documentation = comment.text.text; ImportVexRectangle(docComment, comment.layout.rectangle, schemata); docSchema.Comments.Add(docComment); } } else if (obj is INTERFACE_SCHEMA) { INTERFACE_SCHEMA iface = (INTERFACE_SCHEMA)obj; DocSchemaRef docSchemaRef = new DocSchemaRef(); docSchema.SchemaRefs.Add(docSchemaRef); docSchemaRef.Name = iface.schema_name; foreach (object o in iface.item) { if (o is DEFINITION) { DocDefinitionRef docDefRef = new DocDefinitionRef(); docSchemaRef.Definitions.Add(docDefRef); mapRefs.Add(o, docDefRef); docDefRef.Name = ((DEFINITION)o).name.text; if (o is DEFINED_TYPE) { DEFINED_TYPE dt = (DEFINED_TYPE)o; if (dt.layout != null) { ImportVexRectangle(docDefRef, dt.layout.rectangle, schemata); } } else if (o is ENTITIES) { ENTITIES ents = (ENTITIES)o; if (ents.layout != null) // null for IfcPolyline reference in IfcGeometricModelResource { ImportVexRectangle(docDefRef, ents.layout.rectangle, schemata); } if (ents.subtypes != null) { foreach (SUBTYPE_DEF subdef in ents.subtypes) { OBJECT_LINE_LAYOUT linelayout = subdef.layout; DocLine docSub = new DocLine(); ImportVexLine(subdef.layout, null, docSub.DiagramLine, null); docDefRef.Tree.Add(docSub); if(subdef.the_subtype is TREE) { TREE tree = (TREE)subdef.the_subtype; foreach(object oo in tree.list) { if(oo is SUBTYPE_DEF) { SUBTYPE_DEF subsubdef = (SUBTYPE_DEF)oo; DocLine docSubSub = new DocLine(); docSub.Tree.Add(docSubSub); ImportVexLine(subsubdef.layout, null, docSubSub.DiagramLine, null); mapSubs.Add(subsubdef, docSubSub); } } } } } } else if (o is ENUMERATIONS) { ENUMERATIONS enums = (ENUMERATIONS)o; if (enums.typelayout != null) { ImportVexRectangle(docDefRef, enums.typelayout.rectangle, schemata); } } else if (o is SELECTS) { SELECTS sels = (SELECTS)o; if (sels.typelayout != null) { ImportVexRectangle(docDefRef, sels.typelayout.rectangle, schemata); } } else if(o is SCHEMA_REF) { SCHEMA_REF sref = (SCHEMA_REF)o; if(sref.layout != null) { ImportVexRectangle(docDefRef, sref.layout.rectangle, schemata); } } } else if (o is USER_FUNCTION) { DocDefinitionRef docDefRef = new DocDefinitionRef(); docSchemaRef.Definitions.Add(docDefRef); USER_FUNCTION uf = (USER_FUNCTION)o; docDefRef.Name = uf.name; } } } else if (obj is PAGE_REF) { PAGE_REF pageref = (PAGE_REF)obj; DocPageTarget docPageTarget = new DocPageTarget(); docSchema.PageTargets.Add(docPageTarget); docPageTarget.Name = pageref.text.text; docPageTarget.DiagramNumber = pageref.pagenr; ImportVexLine(pageref.pageline.layout, null, docPageTarget.DiagramLine, null); ImportVexRectangle(docPageTarget, pageref.layout.rectangle, schemata); foreach (PAGE_REF_TO pagerefto in pageref.pagerefto) { DocPageSource docPageSource = new DocPageSource(); docPageTarget.Sources.Add(docPageSource); docPageSource.DiagramNumber = pagerefto.pagenr; docPageSource.Name = pagerefto.text.text; ImportVexRectangle(docPageSource, pagerefto.layout.rectangle, schemata); mapRefs.Add(pagerefto, docPageSource); } mapPage.Add(pageref, docPageTarget); } } foreach (DocObject docobj in existing) { if (docobj is DocEntity) { docSchema.Entities.Remove((DocEntity)docobj); } else if (docobj is DocType) { docSchema.Types.Remove((DocType)docobj); } else if (docobj is DocFunction) { docSchema.Functions.Remove((DocFunction)docobj); } else if (docobj is DocGlobalRule) { docSchema.GlobalRules.Remove((DocGlobalRule)docobj); } docobj.Delete(); } // now fix up attributes foreach (ATTRIBUTE_DEF docAtt in mapAtts.Keys) { DocAttribute docAttr = mapAtts[docAtt]; docAttr.Definition = mapRefs[docAtt.the_attribute]; } foreach (PAGE_REF page in mapPage.Keys) { DocPageTarget docPage = mapPage[page]; docPage.Definition = mapRefs[page.pageline.pageref]; } foreach (SELECT_DEF sd in mapSL.Keys) { DocLine docLine = mapSL[sd]; if (mapRefs.ContainsKey(sd.def)) { docLine.Definition = mapRefs[sd.def]; } } foreach (SUBTYPE_DEF sd in mapSubs.Keys) { DocLine docLine = mapSubs[sd]; if (mapRefs.ContainsKey(sd.the_subtype)) { docLine.Definition = mapRefs[sd.the_subtype]; } } foreach(object o in mapRefs.Keys) { if (o is DEFINED_TYPE) { DEFINED_TYPE def = (DEFINED_TYPE)o; if (def.interfaceto == null || def.interfaceto.theschema == null) { // declared within DocDefined docDef = (DocDefined)mapRefs[o]; docDef.Definition = mapRefs[def.defined.defined]; } } } return docSchema; }
/// <summary> /// Create Facts (the accounting logic) for /// CMC. /// <pre> /// Expense /// CashExpense DR /// CashAsset CR ///Receipt /// CashAsset DR /// CashReceipt CR /// Charge /// Charge DR /// CashAsset CR /// Difference /// CashDifference DR /// CashAsset CR /// Invoice /// CashAsset DR /// CashTransfer CR /// Transfer /// BankInTransit DR /// CashAsset CR /// </pre> /// </summary> /// <param name="?"></param> /// <returns>Fact</returns> public override List <Fact> CreateFacts(MAcctSchema as1) { // create Fact Header List <Fact> facts = new List <Fact>(); if (GetDocumentType().Equals(MDocBaseType.DOCBASETYPE_PROFITLOSS)) { //Change By mohit // Get Assigned Accounting Schemas based on organization MProfitLossLines PLossline = new MProfitLossLines(GetCtx(), _lines[0].Get_ID(), null); MProfitLoss PLoss = new MProfitLoss(GetCtx(), PLossline.GetC_ProfitLoss_ID(), null); MAcctSchema HeaderAcctSchema = new MAcctSchema(GetCtx(), Util.GetValueOfInt(PLoss.Get_Value("C_AcctSchema_ID")), null); List <int> _ListAcctSch = new List <int>(); // Profit & Loss account shall be posted only in accounting schema selected on header (By Ashish - discussed with Mukesh sir) //_ListAcctSch = GetAcctSchemas(PLoss.GetAD_Org_ID()); _ListAcctSch.Add(HeaderAcctSchema.GetC_AcctSchema_ID()); if (_ListAcctSch.Count > 0) { int CurrencyType_ID = GetDefaultConversionType(GetAD_Client_ID(), GetAD_Org_ID()); for (int asch = 0; asch < _ListAcctSch.Count; asch++) { MAcctSchema AccountingSchema = new MAcctSchema(GetCtx(), _ListAcctSch[asch], null); // Decimal grossAmt = getAmount(Doc.AMTTYPE_Gross); SetC_Currency_ID(GetCurrency(AccountingSchema.GetC_AcctSchema_ID())); // Commitment Fact fact = new Fact(this, AccountingSchema, Fact.POST_Actual); Decimal total = Env.ZERO, totalCredit = Env.ZERO, totalDebit = Env.ZERO; Decimal credit = Env.ZERO, debit = Env.ZERO; for (int i = 0; i < _lines.Length; i++) { DocLine dline = _lines[i]; MProfitLossLines line = new MProfitLossLines(GetCtx(), dline.Get_ID(), null); if (Util.GetValueOfInt(HeaderAcctSchema.GetC_Currency_ID()) == Util.GetValueOfInt(AccountingSchema.GetC_Currency_ID())) { credit = Util.GetValueOfDecimal(dline.GetAmtSourceCr()); debit = Util.GetValueOfDecimal(dline.GetAmtSourceDr()); } else { credit = MConversionRate.Convert(GetCtx(), Util.GetValueOfDecimal(dline.GetAmtSourceCr()), HeaderAcctSchema.GetC_Currency_ID(), AccountingSchema.GetC_Currency_ID(), PLoss.GetDateAcct(), CurrencyType_ID, GetAD_Client_ID(), GetAD_Org_ID()); debit = MConversionRate.Convert(GetCtx(), Util.GetValueOfDecimal(dline.GetAmtSourceDr()), HeaderAcctSchema.GetC_Currency_ID(), AccountingSchema.GetC_Currency_ID(), PLoss.GetDateAcct(), CurrencyType_ID, GetAD_Client_ID(), GetAD_Org_ID()); Util.GetValueOfDecimal(dline.GetAmtAcctDr()); } if (credit > 0) { totalCredit = Decimal.Add(totalCredit, credit); } if (debit > 0) { totalDebit = Decimal.Add(totalDebit, debit); } // Account MAccount expense = MAccount.Get(GetCtx(), GetAD_Client_ID(), GetAD_Org_ID(), AccountingSchema.GetC_AcctSchema_ID(), line.GetAccount_ID(), line.GetC_SubAcct_ID(), line.GetM_Product_ID(), line.GetC_BPartner_ID(), line.GetAD_OrgTrx_ID(), line.GetC_LocFrom_ID(), line.GetC_LocTo_ID(), line.GetC_SalesRegion_ID(), line.GetC_Project_ID(), line.GetC_Campaign_ID(), line.GetC_Activity_ID(), line.GetUser1_ID(), line.GetUser2_ID(), line.GetUserElement1_ID(), line.GetUserElement2_ID(), line.GetUserElement3_ID(), line.GetUserElement4_ID(), line.GetUserElement5_ID(), line.GetUserElement6_ID(), line.GetUserElement7_ID(), line.GetUserElement8_ID(), line.GetUserElement9_ID()); fact.CreateLine(dline, expense, GetCurrency(AccountingSchema.GetC_AcctSchema_ID()), debit, credit); } total = totalCredit - totalDebit; if (total != Env.ZERO) { int validComID = Util.GetValueOfInt(DB.ExecuteScalar(@"SELECT IncomeSummary_Acct FROM C_AcctSchema_GL WHERE C_AcctSchema_ID=" + AccountingSchema.GetC_AcctSchema_ID() + " AND AD_Client_ID = " + GetAD_Client_ID())); MAccount acct = MAccount.Get(GetCtx(), validComID); fact.CreateLine(null, acct, GetC_Currency_ID(), total); } //if (TotalCurrLoss != Env.ZERO) //{ // int validComID = Util.GetValueOfInt(DB.ExecuteScalar(@"SELECT C_ValidCombination_ID FROM C_ValidCombination WHERE Account_ID= ( SELECT C_ElementValue_ID FROM C_ElementValue WHERE Value='82540' AND AD_Client_ID = " + GetAD_Client_ID() + " )")); // MAccount acct = MAccount.Get(GetCtx(), validComID); // TotalCurrLoss = MConversionRate.Convert(GetCtx(), TotalCurrLoss, childCashCurrency, headerCashCurrency, GetAD_Client_ID(), GetAD_Org_ID()); // fact.CreateLine(null, acct, // GetC_Currency_ID(), (TotalCurrLoss)); //} facts.Add(fact); } } } return(facts); }
private static void DrawTree(Graphics g, DocLine docSub, double factor, Point ptLast, DiagramFormat format) { Point ptNext = Point.Empty; if (docSub.DiagramLine != null) { float penwidth = 0.0f; if(format == DiagramFormat.ExpressG) { penwidth = 3.0f; } else if (format == DiagramFormat.UML) { // draw arrow at supertype if (ptLast == Point.Empty && docSub.DiagramLine.Count >= 2) { using (Pen penAttr = new Pen(Color.Black)) { AdjustableArrowCap cap = new AdjustableArrowCap(6.0f, 6.0f, true); penAttr.StartCap = LineCap.Custom; penAttr.CustomStartCap = cap; g.DrawLine(penAttr, (float)(docSub.DiagramLine[0].X * factor), (float)(docSub.DiagramLine[0].Y * factor), (float)(docSub.DiagramLine[1].X * factor), (float)(docSub.DiagramLine[1].Y * factor)); } } } using (Pen pen = new Pen(Color.Black, penwidth)) { for (int i = 0; i < docSub.DiagramLine.Count - 1; i++) { Point ptA = new Point((int)(docSub.DiagramLine[i].X * factor), (int)(docSub.DiagramLine[i].Y * factor)); Point ptB = new Point((int)(docSub.DiagramLine[i].X * factor), (int)(docSub.DiagramLine[i + 1].Y * factor)); Point ptC = new Point((int)(docSub.DiagramLine[i + 1].X * factor), (int)(docSub.DiagramLine[i + 1].Y * factor)); if (i == 0 && ptLast != Point.Empty) { g.DrawLine(pen, ptLast, ptA); } ptNext = ptC; g.DrawLine(pen, ptA, ptB); g.DrawLine(pen, ptB, ptC); } } } foreach (DocLine docInner in docSub.Tree) { DrawTree(g, docInner, factor, ptNext, format); } }