/// <summary> /// Default KPI Constructor /// </summary> public KPI() { plan = new Plan(); purch = new Purch(); followUp = new FollowUp(); planTwo = new PlanTwo(); purchTwo = new PurchTwo(); purchSub = new PurchSub(); purchTotal = new PurchTotal(); purchPlan = new PurchPlan(); purchPlanTotal = new PurchPlanTotal(); other = new Other(); }
/// <summary> /// Default KPA Constructor /// </summary> public KPA() { plan = new Plan(); purch = new Purch(); purchSub = new Purch_Sub(); purchTotal = new Purch_Total(); purchPlanTotal = new Purch_Plan_Total(); followUp = new Follow_Up(); cancellations = new Cancellations(); ncrs = new NCRs(); hotJobs = new Hot_Jobs(); excessStockStock = new Excess_Stock_Stock(); excessStockOpenOrders = new Excess_Stock_Open_Order(); currPlanVsActual = new Current_Plan_vs_Actual(); mtc = new MTC(); }
public static PURCHASE _SA_Read(PURCHASE TransRecord, bool bOneTime) // method will read all fields and store the data in a PURCHASE record { PURCHASE Purch; // load it in adjustment mode first if (Functions.GoodData(TransRecord)) // load the transaction if specified { PurchasesJournal._SA_Open(TransRecord, true, bOneTime); } // set focus from the settings window back to the journal window //PurchasesJournal.Instance.Window.SetActive(); // create the correct object based on the transaction type string transType = PurchasesJournal.repo.TransTypeDropDown.SelectedItemText; if (transType.ToLower().Contains("invoice")) { Purch = new PURCHASE_INVOICE(); } else if (transType.ToLower().Contains("order")) { Purch = new PURCHASE_ORDER(); } else if (transType.ToLower().Contains("quote")) { Purch = new PURCHASE_QUOTE(); } else { Purch = new PURCHASE_INVOICE(); //Functions.Verify(false, true, "Valid value from transaction list"); } if (Purch.GetType() != typeof(PURCHASE_QUOTE)) // i.e. order or invoice { // Set Paid by and ChequeNumbers ((PURCHASE_COMMON_ORDER_INVOICE)Purch).paymentMethod = PurchasesJournal.repo.PaidBy.SelectedItemText; if (PurchasesJournal.repo.PaidFromInfo.Exists()) { { ((PURCHASE_COMMON_ORDER_INVOICE)Purch).PaidFromAccount.acctNumber = PurchasesJournal.repo.PaidFrom.SelectedItemText; } } if (PurchasesJournal.repo.ChequeNumberInfo.Exists()) { { ((PURCHASE_COMMON_ORDER_INVOICE)Purch).chequeNumber = PurchasesJournal.repo.ChequeNumber.TextValue; } } } if (Purch.GetType() == typeof(PURCHASE_INVOICE)) // set style for invoice, transaction number, & Quote Number if present { { Purch.transNumber = PurchasesJournal.repo.InvoiceNumber.TextValue; if (PurchasesJournal.repo.OrderQuoteNoInfo.Exists()) // doesn't exists for one time { ((PURCHASE_INVOICE)Purch).quoteOrderTransNumber = PurchasesJournal.repo.OrderQuoteNoText.TextValue; } } } else // set transaction number and shipping date for order/quote { Purch.transNumber = PurchasesJournal.repo.OrderQuoteNoText.TextValue; Purch.shipDate = PurchasesJournal.repo.ShipDate.TextValue; } Purch.Vendor.name = PurchasesJournal.repo.VendorNameText.TextValue; Purch.transDate = PurchasesJournal.repo.InvoiceDate.TextValue; if (PurchasesJournal.repo.ExchangeRateInfo.Exists()) { Purch.exchangeRate = PurchasesJournal.repo.ExchangeRate.TextValue; } if (PurchasesJournal.repo.StoreItemsAtInfo.Exists()) { if (PurchasesJournal.repo.StoreItemsAt.Enabled) { Purch.shipToLocation = PurchasesJournal.repo.StoreItemsAt.SelectedItemText; } } // prepare the container PURCH_TABLE PT = new PURCH_TABLE(); // InitializeTable(PT); //int iNumOfCols = PurchasesJournal.repo.TransContainer.ColumnCount; //List<string[]> containerLine = ConvertFunctions.DataGridItemsToListOfString(PurchasesJournal.Instance.TransContainer.Items, iNumOfCols); List <List <string> > Contents = PurchasesJournal.repo.TransContainer.GetContents(); List <ROW> lR = new List <ROW>() { }; //for (int x = 0; x < containerLine.Count; x++) foreach (List <string> currRow in Contents) { // it's a blank row if the item number, quantity received, quantity ordered, description, and amount fields are all blank if ((currRow[PT.iItem] == "") && (currRow[PT.iQuantity] == "") && (currRow[PT.iOrder] == "") && (currRow[PT.iDescription] == "") && (currRow[PT.iAmount] == "")) { // do not add } else { ROW R = new ROW(); // assign recordset R.Item.invOrServNumber = ConvertFunctions.CommaToText(currRow[PT.iItem]); R.quantityReceived = ConvertFunctions.CommaToText(currRow[PT.iQuantity]); R.quantityOrdered = ConvertFunctions.CommaToText(currRow[PT.iOrder]); R.quantityBackordered = ConvertFunctions.CommaToText(currRow[PT.iBackOrder]); R.unit = ConvertFunctions.CommaToText(currRow[PT.iUnit]); //R.Item.invOrServDescription = StrTran(containerLine[5+ iItmColID], "," ,"\comma") // wrong record field R.description = ConvertFunctions.CommaToText(currRow[PT.iDescription]); R.price = ConvertFunctions.CommaToText(currRow[PT.iPrice]); R.TaxCode.code = ConvertFunctions.CommaToText(currRow[PT.iTax]); // blank when no tax R.amount = ConvertFunctions.CommaToText(currRow[PT.iAmount]); R.Account.acctNumber = ConvertFunctions.CommaToText(currRow[PT.iAccount]); // append to detail list lR.Add(R); } //// only remove if more than one line is present. NC - no longer needed so commented out //if(containerLine.Count >iNumOfCols) //{ // // remove line already recorded // for ( int i = 0; i < iNumOfCols; i++) // { // containerLine.RemoveAt(1); // } //} //else //{ // containerLine.RemoveAt(1); //} } // add rows to the record Purch.GridRows = lR; // read project allocation data if (Functions.GoodData(Purch.GridRows)) { //PurchasesJournal.Instance.VendorName.SetFocus(); // Set focus within the journal first, or else sometimes cannot select the account field. for (int x = 0; x < Purch.GridRows.Count; x++) { if (Functions.GoodData(Purch.GridRows[x].amount)) // proceed only if amount is available { PurchasesJournal.repo.TransContainer.SelectCell("Account", x); // select account field PurchasesJournal.repo.TransContainer.PressKeys("{Ctrl Shift}a"); if (ProjectAllocationDialog.repo.SelfInfo.Exists()) { Purch.GridRows[x].Projects = ProjectAllocationDialog._SA_GetProjectAllocationDetails(); // get dialog content ProjectAllocationDialog.repo.Cancel.Click(); } } } } if (PurchasesJournal.repo.PrepayRefNumberInfo.Exists()) { ((PURCHASE_ORDER)Purch).prepayRefNumber = PurchasesJournal.repo.PrepayRefNumber.TextValue; ((PURCHASE_ORDER)Purch).prepaymentAmount = PurchasesJournal.repo.PrepaymentAmount.TextValue; } Purch.freightAmount = PurchasesJournal.repo.FreightAmount.TextValue; Purch.FreightTaxCode.code = PurchasesJournal.repo.FreightCode.TextValue; if (PurchasesJournal.repo.FreightTaxTotalInfo.Exists()) // db has more than 2 taxes defined { Purch.freightTaxTotal = PurchasesJournal.repo.FreightTaxTotal.TextValue; } else // only two taxes and both shown { Purch.freightTax1 = PurchasesJournal.repo.FreightTax1.TextValue; // will not show if only one tax is shown if (PurchasesJournal.repo.FreightTax2Info.Exists()) { Purch.freightTax2 = PurchasesJournal.repo.FreightTax2.TextValue; } } if (PurchasesJournal.repo.TermsPercentInfo.Exists()) { Purch.termsPercent = PurchasesJournal.repo.TermsPercent.TextValue; Purch.termsDays = PurchasesJournal.repo.TermsDay.TextValue; Purch.termsNetDays = PurchasesJournal.repo.TermsNetDays.TextValue; } if (PurchasesJournal.repo.EarlyDiscountInfo.Exists()) { ((PURCHASE_INVOICE)Purch).earlyPaymentDiscountPercent = PurchasesJournal.repo.EarlyDiscount.TextValue; } if (Purch.GetType() == typeof(PURCHASE_INVOICE)) // set tracking { if (Functions.GoodData(Purch.shippedBy) || Functions.GoodData(Purch.trackingNumber)) { PurchasesJournal.repo.Self.PressKeys("{Ctrl}k"); Purch.shippedBy = TrackShipments.repo.Shipper.SelectedItemText; Purch.trackingNumber = TrackShipments.repo.TrackingNumber.TextValue; TrackShipments.repo.OK.Click(); } } return(Purch); }