private int InventoryOut(oInventoryTransaction invTransaction) { Documents invOut = SboComObject.GetBusinessObject(BoObjectTypes.oInventoryGenExit); try { SboComObject.StartTransaction(); int retCode = 0; invOut.DocDate = invTransaction.DocDate; invOut.TaxDate = invTransaction.TaxDate; invOut.Reference2 = invTransaction.ReferenceNo; invOut.Series = invTransaction.Series; invOut.Comments = invTransaction.Remarks; invOut.JournalMemo = invTransaction.JournalRemarks; invOut.BPL_IDAssignedToInvoice = invTransaction.BranchId; if (invTransaction.TransactionLines.Count > 0) { foreach (oInventoryTransactionLine line in invTransaction.TransactionLines) { invOut.Lines.SetCurrentLine(line.LineNo); invOut.Lines.ItemCode = line.ItemCode; invOut.Lines.Quantity = line.Quantity; invOut.Lines.Price = line.Price; invOut.Lines.WarehouseCode = line.WarehouseId; invOut.Lines.AccountCode = line.GLAccountCode; invOut.Lines.Add(); } } retCode = invOut.Add(); if (retCode != 0) { int errCode = 0; string errMessage = ""; SboComObject.GetLastError(out errCode, out errMessage); GlobalInstance.Instance.SBOErrorCode = errCode; GlobalInstance.Instance.SBOErrorMessage = errMessage; SboComObject.EndTransaction(BoWfTransOpt.wf_RollBack); } else { SboComObject.EndTransaction(BoWfTransOpt.wf_Commit); } return(retCode); } catch (Exception ex) { System.Runtime.InteropServices.Marshal.ReleaseComObject(invOut); throw new Exception(GlobalInstance.Instance.SBOErrorMessage == null ? ex.Message : GlobalInstance.Instance.SBOErrorMessage); } finally { System.Runtime.InteropServices.Marshal.ReleaseComObject(invOut); } }
public int Add(oJournal obj) { JournalEntries jrnls = (JournalEntries)SboComObject.GetBusinessObject(BoObjectTypes.oJournalEntries); try { SboComObject.StartTransaction(); int retCode = 0; jrnls.DueDate = obj.DocDueDate; jrnls.TaxDate = obj.TaxDate; jrnls.ReferenceDate = obj.DocDate; jrnls.Memo = obj.JournalMemo; jrnls.ProjectCode = obj.Project; if (obj.JournalLines.Count > 0) { foreach (oJournalLine jrnlLine in obj.JournalLines) { jrnls.Lines.DueDate = obj.DocDueDate; jrnls.Lines.TaxDate = obj.TaxDate; jrnls.Lines.ReferenceDate1 = obj.DocDate; jrnls.Lines.ShortName = jrnlLine.GLCode; jrnls.Lines.BPLID = jrnlLine.Segment; jrnls.Lines.Debit = jrnlLine.Debit; jrnls.Lines.Credit = jrnlLine.Credit; jrnls.Lines.Add(); } } retCode = jrnls.Add(); if (retCode != 0) { int errCode = 0; string errMessage = ""; SboComObject.GetLastError(out errCode, out errMessage); GlobalInstance.Instance.SBOErrorCode = errCode; GlobalInstance.Instance.SBOErrorMessage = errMessage; SboComObject.EndTransaction(BoWfTransOpt.wf_RollBack); } else { SboComObject.EndTransaction(BoWfTransOpt.wf_Commit); } return(retCode); } catch (Exception ex) { System.Runtime.InteropServices.Marshal.ReleaseComObject(jrnls); throw new Exception(GlobalInstance.Instance.SBOErrorMessage == null? ex.Message: GlobalInstance.Instance.SBOErrorMessage); } finally { System.Runtime.InteropServices.Marshal.ReleaseComObject(jrnls); } }
public int AddMultiple(List <oItem> objs) { Items itm = null; try { SboComObject.StartTransaction(); int retCode = 0; foreach (oItem obj in objs) { itm = (Items)SboComObject.GetBusinessObject(BoObjectTypes.oItems); itm.ItemCode = obj.ItemCode; itm.ItemName = obj.Description; itm.Series = obj.Series; itm.ItemsGroupCode = obj.ItemGroup; itm.InventoryItem = obj.InventoryItem == "Y" ? BoYesNoEnum.tYES : BoYesNoEnum.tNO; itm.PurchaseItem = obj.PurchaseItem == "Y" ? BoYesNoEnum.tYES : BoYesNoEnum.tNO; itm.SalesItem = obj.SalesItem == "Y" ? BoYesNoEnum.tYES : BoYesNoEnum.tNO; itm.UoMGroupEntry = obj.UoMGroup; itm.BarCode = obj.Barcode; retCode = itm.Add(); if (retCode > 0) { break; } } if (retCode > 0) { int errCode = 0; string errMessage = ""; SboComObject.GetLastError(out errCode, out errMessage); GlobalInstance.Instance.SBOErrorCode = errCode; GlobalInstance.Instance.SBOErrorMessage = errMessage; SboComObject.EndTransaction(BoWfTransOpt.wf_RollBack); } else { SboComObject.EndTransaction(BoWfTransOpt.wf_Commit); } return(retCode); } catch { throw new Exception(GlobalInstance.Instance.SBOErrorMessage); } finally { System.Runtime.InteropServices.Marshal.ReleaseComObject(itm); } }
public int AddMultiple(List <oBusinessPartner> objs) { BusinessPartners _bp = null; try { SboComObject.StartTransaction(); int retCode = 0; foreach (oBusinessPartner obj in objs) { _bp.CardCode = obj.CardCode; _bp.CardName = obj.CardName; _bp.Address = obj.Address; _bp.CardType = obj.CardType == "C" ? BoCardTypes.cCustomer : BoCardTypes.cSupplier; _bp.ContactPerson = obj.CntctPerson; _bp.Cellular = obj.Cellular; _bp.Phone1 = obj.Phone1; _bp.Phone2 = obj.Phone2; _bp.EmailAddress = obj.Email; _bp.DebitorAccount = obj.DebPayAcct; retCode = _bp.Add(); if (retCode > 0) { break; } } if (retCode > 0) { int errCode = 0; string errMessage = ""; SboComObject.GetLastError(out errCode, out errMessage); GlobalInstance.Instance.SBOErrorCode = errCode; GlobalInstance.Instance.SBOErrorMessage = errMessage; SboComObject.EndTransaction(BoWfTransOpt.wf_RollBack); } else { SboComObject.EndTransaction(BoWfTransOpt.wf_Commit); } return(retCode); } catch { throw new Exception(GlobalInstance.Instance.SBOErrorMessage); } finally { System.Runtime.InteropServices.Marshal.ReleaseComObject(_bp); } }
public int AddMultiple(List <oGlAccount> objs) { ChartOfAccounts coa = null; try { SboComObject.StartTransaction(); int retcode = 0; foreach (oGlAccount obj in objs) { coa = (ChartOfAccounts)SboComObject.GetBusinessObject(BoObjectTypes.oChartOfAccounts); coa.Code = obj.AccntCode; coa.Name = obj.AccntName; coa.BPLID = obj.BPLId; coa.FormatCode = obj.FormatCode; retcode = coa.Add(); if (retcode > 0) { break; } } if (retcode > 0) { int errCode = 0; string errMessage = ""; SboComObject.GetLastError(out errCode, out errMessage); GlobalInstance.Instance.SBOErrorCode = errCode; GlobalInstance.Instance.SBOErrorMessage = errMessage; SboComObject.EndTransaction(BoWfTransOpt.wf_RollBack); } else { SboComObject.EndTransaction(BoWfTransOpt.wf_Commit); } return(retcode); } catch { throw new Exception(GlobalInstance.Instance.SBOErrorMessage); } finally { System.Runtime.InteropServices.Marshal.ReleaseComObject(coa); } }
public int Update(oGlAccount obj) { ChartOfAccounts coa = (ChartOfAccounts)SboComObject.GetBusinessObject(BoObjectTypes.oChartOfAccounts); try { SboComObject.StartTransaction(); int retcode = 0; if (obj.IsSegmented) { coa.LoadingFactorCode = obj.Segment_0; coa.LoadingFactorCode2 = obj.Segment_1; } else { coa.Code = obj.AccntCode; } coa.Name = obj.AccntName; coa.BPLID = obj.BPLId; coa.LockManualTransaction = obj.IsControlAccount == "Y" ? BoYesNoEnum.tYES : BoYesNoEnum.tNO; coa.ActiveAccount = obj.IsPostable == "Y" ? BoYesNoEnum.tYES : BoYesNoEnum.tNO; retcode = coa.Update(); if (retcode > 0) { int errCode = 0; string errMessage = ""; SboComObject.GetLastError(out errCode, out errMessage); GlobalInstance.Instance.SBOErrorCode = errCode; GlobalInstance.Instance.SBOErrorMessage = errMessage; SboComObject.EndTransaction(BoWfTransOpt.wf_RollBack); } else { SboComObject.EndTransaction(BoWfTransOpt.wf_Commit); } return(retcode); } catch { throw new Exception(GlobalInstance.Instance.SBOErrorMessage); } finally { System.Runtime.InteropServices.Marshal.ReleaseComObject(coa); } }
public int Update(oItem obj) { Items itm = (Items)SboComObject.GetBusinessObject(BoObjectTypes.oItems); try { SboComObject.StartTransaction(); int retCode = 0; itm.GetByKey(obj.ItemCode); itm.ItemName = obj.Description; itm.Series = obj.Series; itm.ItemsGroupCode = obj.ItemGroup; itm.InventoryItem = obj.InventoryItem == "Y" ? BoYesNoEnum.tYES : BoYesNoEnum.tNO; itm.PurchaseItem = obj.PurchaseItem == "Y" ? BoYesNoEnum.tYES : BoYesNoEnum.tNO; itm.SalesItem = obj.SalesItem == "Y" ? BoYesNoEnum.tYES : BoYesNoEnum.tNO; itm.UoMGroupEntry = obj.UoMGroup; itm.BarCode = obj.Barcode; itm.PriceList.SetCurrentLine(0); itm.PriceList.Price = obj.SellPrice; retCode = itm.Update(); if (retCode != 0) { int errCode = 0; string errMessage = ""; SboComObject.GetLastError(out errCode, out errMessage); GlobalInstance.Instance.SBOErrorCode = errCode; GlobalInstance.Instance.SBOErrorMessage = errMessage; SboComObject.EndTransaction(BoWfTransOpt.wf_RollBack); } else { SboComObject.EndTransaction(BoWfTransOpt.wf_Commit); } return(retCode); } catch { throw new Exception(GlobalInstance.Instance.SBOErrorMessage); } finally { System.Runtime.InteropServices.Marshal.ReleaseComObject(itm); } }
public int Update(oBusinessPartner obj) { BusinessPartners _bp = (BusinessPartners)SboComObject.GetBusinessObject(BoObjectTypes.oBusinessPartners); try { SboComObject.StartTransaction(); int retCode = 0; _bp.GetByKey(obj.CardCode); _bp.CardName = obj.CardName; _bp.Address = obj.Address; _bp.ContactPerson = obj.CntctPerson; _bp.Cellular = obj.Cellular; _bp.Phone1 = obj.Phone1; _bp.Phone2 = obj.Phone2; _bp.EmailAddress = obj.Email; retCode = _bp.Update(); if (retCode != 0) { int errCode = 0; string errMessage = ""; SboComObject.GetLastError(out errCode, out errMessage); GlobalInstance.Instance.SBOErrorCode = errCode; GlobalInstance.Instance.SBOErrorMessage = errMessage; SboComObject.EndTransaction(BoWfTransOpt.wf_RollBack); } else { SboComObject.EndTransaction(BoWfTransOpt.wf_Commit); } return(retCode); } catch (Exception ex) { System.Runtime.InteropServices.Marshal.ReleaseComObject(_bp); throw new Exception(GlobalInstance.Instance.SBOErrorMessage == null ? ex.Message : GlobalInstance.Instance.SBOErrorMessage); } finally { System.Runtime.InteropServices.Marshal.ReleaseComObject(_bp); } }
public int Add(oPayment obj) { Payments payment = (Payments)SboComObject.GetBusinessObject(BoObjectTypes.oVendorPayments); try { SboComObject.StartTransaction(); int retCode = 0; if (obj.DocType != "A") { payment.DocType = BoRcptTypes.rAccount; } if (obj.DocType != "S") { payment.DocType = BoRcptTypes.rSupplier; } if (obj.DocType != "C") { payment.DocType = BoRcptTypes.rCustomer; } payment.CardCode = obj.CardCode; payment.CardName = obj.CardName; payment.Series = obj.Series == 0 ? -1 : obj.Series;//get default series payment.DocDate = obj.DocDate; payment.TaxDate = obj.TaxDate; payment.DueDate = obj.DocDueDate; payment.Remarks = obj.Comments; payment.JournalRemarks = obj.JournalMemo; payment.CounterReference = obj.ReferenceNo; payment.CashSum = obj.CashSum; payment.CashAccount = obj.CashAccount; payment.TransferAccount = obj.BankTransferAccount; payment.TransferSum = obj.BankTransferSum; payment.TransferReference = obj.BankTransferReference; payment.TransferDate = obj.BankTransferDate; if (GlobalInstance.Instance.IsSegmented) { payment.BPLID = obj.BranchId; } if (GlobalInstance.Instance.HasCostCenter) { payment.ProjectCode = obj.ProjectId; } if (obj.PaymentLines.Count != 0) { int invCtr = 0; foreach (oPaymentLine p in obj.PaymentLines) { payment.Invoices.SetCurrentLine(invCtr); payment.Invoices.SumApplied = p.SumApplied; payment.Invoices.AppliedFC = p.SumApplied; payment.Invoices.DocEntry = p.InvoiceNo; payment.Invoices.InvoiceType = BoRcptInvTypes.it_Invoice; payment.Invoices.Add(); invCtr += 1; } } if (obj.CheckPayments.Count != 0) { int chkCtr = 0; foreach (oCheckPayment chk in obj.CheckPayments) { payment.Checks.SetCurrentLine(chkCtr); payment.Checks.CheckSum = chk.CheckSum; payment.Checks.CheckNumber = chk.CheckNum; payment.Checks.BankCode = chk.BankCode; payment.Checks.AccounttNum = chk.AccountNo; payment.Checks.CheckAccount = chk.CheckAccount; payment.Checks.Trnsfrable = chk.IsTransferable == "Y" ? BoYesNoEnum.tYES: BoYesNoEnum.tNO; chkCtr += 1; } } if (obj.CreditPayments.Count != 0) { int credCtr = 0; foreach (oCreditPayment cr in obj.CreditPayments) { payment.CreditCards.SetCurrentLine(credCtr); payment.CreditCards.CreditAcct = cr.CreditAccount; payment.CreditCards.CreditCard = cr.CreditCard; payment.CreditCards.NumOfPayments = cr.NumberOfPayments; payment.CreditCards.CreditSum = cr.CreditSum; payment.CreditCards.FirstPaymentDue = cr.FirstDue; payment.CreditCards.FirstPaymentSum = cr.FirstPayment; payment.CreditCards.VoucherNum = cr.VoucherNo; payment.CreditCards.SplitPayments = cr.SplitCredit == "Y" ? BoYesNoEnum.tYES: BoYesNoEnum.tNO; payment.CreditCards.Add(); } } retCode = payment.Add(); if (retCode != 0) { int errCode = 0; string errMessage = ""; SboComObject.GetLastError(out errCode, out errMessage); GlobalInstance.Instance.SBOErrorCode = errCode; GlobalInstance.Instance.SBOErrorMessage = errMessage; SboComObject.EndTransaction(BoWfTransOpt.wf_RollBack); } else { SboComObject.EndTransaction(BoWfTransOpt.wf_Commit); } return(retCode); } catch (Exception ex) { System.Runtime.InteropServices.Marshal.ReleaseComObject(payment); throw new Exception(GlobalInstance.Instance.SBOErrorMessage == null ? ex.Message : GlobalInstance.Instance.SBOErrorMessage); } finally { System.Runtime.InteropServices.Marshal.ReleaseComObject(payment); } }
public int Add(oBusinessPartner obj) { BusinessPartners _bp = (BusinessPartners)SboComObject.GetBusinessObject(BoObjectTypes.oBusinessPartners); SeriesRepository s = new SeriesRepository(); s.InitRepository(GlobalInstance.Instance.SqlObject); var tempList = s.GetList(null); oSeries _s = new oSeries(); _s = tempList.Result.FirstOrDefault(x => x.ObjectCode == ((int)SboTransactionType.BP).ToString() && x.Series == obj.Series && x.DocSubType == obj.CardType); try { SboComObject.StartTransaction(); int retCode = 0; if (_s != null) { if (_s.SeriesName.ToLower() == "manual") { _bp.CardCode = obj.CardCode; } } _bp.Series = obj.Series; _bp.GroupCode = obj.GroupCode; _bp.CardName = obj.CardName; _bp.Address = obj.Address; _bp.CardType = obj.CardType == "C" ? BoCardTypes.cCustomer : BoCardTypes.cSupplier; _bp.ContactPerson = obj.CntctPerson; _bp.Cellular = obj.Cellular; _bp.Phone1 = obj.Phone1; _bp.Phone2 = obj.Phone2; _bp.EmailAddress = obj.Email; retCode = _bp.Add(); if (retCode != 0) { int errCode = 0; string errMessage = ""; SboComObject.GetLastError(out errCode, out errMessage); GlobalInstance.Instance.SBOErrorCode = errCode; GlobalInstance.Instance.SBOErrorMessage = errMessage; SboComObject.EndTransaction(BoWfTransOpt.wf_RollBack); } else { SboComObject.EndTransaction(BoWfTransOpt.wf_Commit); } return(retCode); } catch (Exception ex) { System.Runtime.InteropServices.Marshal.ReleaseComObject(_bp); throw new Exception(GlobalInstance.Instance.SBOErrorMessage == null ? ex.Message : GlobalInstance.Instance.SBOErrorMessage); } finally { System.Runtime.InteropServices.Marshal.ReleaseComObject(_bp); } }