public static RECEIPT _SA_Read(RECEIPT ReceiptRecord) // method will read all fields and store the data in a RECEIPT record { RECEIPT Rec = new RECEIPT(); if (Functions.GoodData(ReceiptRecord)) { ReceiptsJournal._SA_Open(ReceiptRecord); } Rec.paidBy = ReceiptsJournal.repo.PaidBy.SelectedItemText; if (ReceiptsJournal.repo.DepositToInfo.Exists()) { Rec.DepositAccount.acctNumber = ReceiptsJournal.repo.DepositTo.SelectedItemText; } if (ReceiptsJournal.repo.ChequeNumberInfo.Exists()) { { Rec.chequeNumber = ReceiptsJournal.repo.ChequeNumber.TextValue; } } Rec.Customer.name = ReceiptsJournal.repo.CustomerName.SelectedItemText; Rec.transDate = ReceiptsJournal.repo.ReceiptDate.TextValue; if (ReceiptsJournal.repo.ReceiptNumberInfo.Exists()) { Rec.transNumber = ReceiptsJournal.repo.ReceiptNumber.TextValue; } if (ReceiptsJournal.repo.PadNumberInfo.Exists()) { Rec.padNumber = ReceiptsJournal.repo.PadNumber.TextValue; } Rec.GridRows.Clear(); List <List <string> > lsContents = ReceiptsJournal.repo.TransContainer.GetContents(); // a blank row is added at the end of the list if (Functions.GoodData(lsContents)) { bool bDepositLineFound = false; for (int x = 0; x < lsContents.Count; x++) { RECEIPT_ROW RR = new RECEIPT_ROW(); string sRefNum = ConvertFunctions.BlankStringToNULL(lsContents[x][1]); if (Functions.GoodData(sRefNum)) // to avoid adding a blank row { if (sRefNum == "Deposits") { bDepositLineFound = true; } else { if (bDepositLineFound) // deposit row { RR.DepositReceipt.depositRefNum = sRefNum; } else // invoice row { RR.Invoice.transNumber = sRefNum; } RR.discountTaken = ConvertFunctions.BlankStringToNULL(lsContents[x][5]); RR.Amount = ConvertFunctions.BlankStringToNULL(lsContents[x][6]); } Rec.GridRows.Add(RR); } } } Rec.depositRefNum = ReceiptsJournal.repo.DepositReferenceNo.TextValue; Rec.depositAmount = ReceiptsJournal.repo.DepositAmount.TextValue; if (ReceiptsJournal.repo.ExchangeRateInfo.Exists()) { Rec.exchangeRate = ReceiptsJournal.repo.ExchangeRate.TextValue; } Rec.comment = ReceiptsJournal.repo.Comment.TextValue; return(Rec); }
public static PAYMENT_REMIT _SA_ReadPayment_Remit(PAYMENT_REMIT PaymentToRead) // method will read all fields and store the data in a PAYMENT_REMIT record { PAYMENT_REMIT P = new PAYMENT_REMIT(); if (Functions.GoodData(PaymentToRead)) { PaymentsJournal._SA_Open(PaymentToRead); } P.Vendor.name = PaymentsJournal.repo.VendorName.TextValue; if (PaymentsJournal.repo.PaidFromInfo.Exists()) { P.paidFrom.acctNumber = PaymentsJournal.repo.PaidFrom.SelectedItemText; } P.chequeNumber = PaymentsJournal.repo.ChequeNo.TextValue; P.TransDate = PaymentsJournal.repo.PaymentDate.TextValue; P.comment = PaymentsJournal.repo.Comment.TextValue; P.reference = PaymentsJournal.repo.Reference.TextValue; PaymentsJournal.repo.FrequencyButton.Click(); P.remitFrequency = SelectRemittingFrequency.repo.Frequency.SelectedItemText; SelectRemittingFrequency.repo.Cancel.Click(); List <List <string> > lsContents = PaymentsJournal.repo.TransContainer.GetContents(); if (lsContents.Count > 0) { int x; for (x = 0; x < lsContents.Count; x++) { PAY_REMIT_ROW PR = new PAY_REMIT_ROW(); PR.remitName = ConvertFunctions.BlankStringToNULL(lsContents[x][0]); //if (PR.remitName == "") //{ // PR.remitName = null; //} PR.amountOwing = ConvertFunctions.BlankStringToNULL(lsContents[x][1]); //if (PR.amountOwing == "") //{ // PR.amountOwing = null; //} PR.adjustAccount = ConvertFunctions.BlankStringToNULL(lsContents[x][2]); //if (PR.adjustAccount == "") //{ // PR.adjustAccount = null; //} PR.adjustment = ConvertFunctions.BlankStringToNULL(lsContents[x][3]); //if (PR.adjustment == "") //{ // PR.adjustment = null; //} PR.amount = ConvertFunctions.BlankStringToNULL(lsContents[x][4]); //if (PR.amount == "") //{ // PR.amount = null; //} P.GridRows.Add(PR); } } return(P); }