public tePurchaseList GetPurchaseList(int saleNumber, int tillNumber, string userCode, string treatyNumber, string treatyName, out ErrorMessage error) { var sale = _saleManager.GetCurrentSale(saleNumber, tillNumber, 0, userCode, out error); var oTreatyNo = new teTreatyNo() { TreatyNumber = treatyNumber, Name = treatyName }; var offSet = _policyManager.LoadStoreInfo().OffSet; double originalPrice = 0; double taxIncldAmount = 0; sale.TreatyNumber = oTreatyNo.TreatyNumber; sale.TreatyName = oTreatyNo.Name; error = null; var oPurchaseList = new tePurchaseList(); oPurchaseList.Init(oTreatyNo, sale.Sale_Num, sale.TillNumber); var y = oPurchaseList.GetTreatyNo(); foreach (Sale_Line tempLoopVarSl in sale.Sale_Lines) { var sl = tempLoopVarSl; string strError; if (sl.Amount < 0 && sl.IsTaxExemptItem) { taxIncldAmount = -1 * sl.TaxInclPrice; //shiny - Dec9, 2009 - Squamish nation // OriginalPrice = sl.Regular_Price if (_policyManager.TE_ByRate == false) // Regualr Site customers SITE , TE_By rate = no { originalPrice = sl.Regular_Price; // - editing the price for TE is keeping different price in purchaseitem and saleline'SL.price } else if (_policyManager.TE_ByRate) //squamish SITE , TE_By rate = yes { originalPrice = sl.price; } } else { //shiny - Dec9, 2009 - Squamish nation // OriginalPrice = sl.Regular_Price if (_policyManager.TE_ByRate == false) // Regualr Site customers SITE , TE_By rate = no { originalPrice = sl.Regular_Price; // - editing the price for TE is keeping different price in purchaseitem and saleline'SL.price } else if (_policyManager.TE_ByRate) //squamish SITE , TE_By rate = yes { originalPrice = sl.price; } } if (sl.ProductIsFuel && !sl.IsPropane) { if (_policyManager.USE_FUEL) { if (Variables.gPumps == null) { Variables.gPumps = _fuelPumpService.InitializeGetProperty(PosId, _policyManager.TAX_EXEMPT, _policyManager.TE_ByRate, _policyManager.TE_Type, _policyManager.AuthPumpPOS); } string tempSProductKey = _teSystemManager.TeMakeFuelKey(sl.GradeID, Convert.ToInt16(Variables.gPumps.get_Pump(sl.pumpID).TierID), Convert.ToInt16(Variables.gPumps.get_Pump(sl.pumpID).LevelID)); double tempDQuantity = sl.Quantity; var tempIRowNumberInSalesMainForm = sl.Line_Num; bool tempIsFuelItem = true; string tempStockCode = sl.Stock_Code; if (!AddItem(ref oPurchaseList, ref sale, ref oTreatyNo, ref tempSProductKey, ref tempDQuantity, ref originalPrice, ref tempIRowNumberInSalesMainForm, ref tempStockCode, ref taxIncldAmount, ref tempIsFuelItem)) { strError = oPurchaseList.GetLastError(); if (strError == "2") { //MsgBox ("Cannot load Tax Exempt price, Please set Tax Exempt Category for Grade-" & SL.GradeID & " first in the BackOffice system! ") //_resourceManager.CreateMessage(offSet,this, 17, temp_VbStyle, sl.GradeID, 0); error = new ErrorMessage { MessageStyle = _resourceManager.CreateMessage(offSet, 11, 17, sl.GradeID, CriticalOkMessageType), StatusCode = HttpStatusCode.Conflict }; return(null); } if (!string.IsNullOrEmpty(strError) && strError.ToUpper() != "NO ERROR") { //MsgBox ("Error(" & strError & ") for getting Tax Exempt price, will use original price for this sale!") //_resourceManager.CreateMessage(offSet,this, 18, temp_VbStyle2, strError, 0); error = new ErrorMessage { MessageStyle = _resourceManager.CreateMessage(offSet, 11, 18, strError, CriticalOkMessageType), StatusCode = HttpStatusCode.Conflict }; return(null); } break; } } else { var tempSProductKey2 = sl.Stock_Code; double tempDQuantity2 = sl.Quantity; var tempIRowNumberInSalesMainForm2 = sl.Line_Num; bool tempIsFuelItem2 = false; var tempStockCode = sl.Stock_Code; if (!AddItem(ref oPurchaseList, ref sale, ref oTreatyNo, ref tempSProductKey2, ref tempDQuantity2, ref originalPrice, ref tempIRowNumberInSalesMainForm2, ref tempStockCode, ref taxIncldAmount, ref tempIsFuelItem2)) { strError = oPurchaseList.GetLastError(); if (!string.IsNullOrEmpty(strError) && strError.ToUpper() != "NO ERROR") { //_resourceManager.CreateMessage(offSet,this, 18, temp_VbStyle3, strError, 0); error = new ErrorMessage { MessageStyle = _resourceManager.CreateMessage(offSet, 11, 18, strError, CriticalOkMessageType), StatusCode = HttpStatusCode.Conflict }; return(null); } } } } else { var tempSProductKey3 = sl.Stock_Code; double tempDQuantity3 = sl.Quantity; short tempIRowNumberInSalesMainForm3 = sl.Line_Num; bool tempIsFuelItem3 = false; var tempStockCode = sl.Stock_Code; if (!AddItem(ref oPurchaseList, ref sale, ref oTreatyNo, ref tempSProductKey3, ref tempDQuantity3, ref originalPrice, ref tempIRowNumberInSalesMainForm3, ref tempStockCode, ref taxIncldAmount, ref tempIsFuelItem3)) { strError = oPurchaseList.GetLastError(); if (!string.IsNullOrEmpty(strError) && strError.ToUpper() != "NO ERROR") { //_resourceManager.CreateMessage(offSet,this, 18, temp_VbStyle4, strError, 0); error = new ErrorMessage { MessageStyle = _resourceManager.CreateMessage(offSet, 11, 18, strError, CriticalOkMessageType), StatusCode = HttpStatusCode.Conflict }; return(null); } } } } var x = oPurchaseList.GetTreatyNo(); CacheManager.AddPurchaseListSaleForTill(tillNumber, saleNumber, oPurchaseList); return(oPurchaseList); }