public override bool SetRefundedQuantity(ReceiptWares parReceiptWares) { using (var DB = new SQLite(ReceiptFile)) { return(DB.ExecuteNonQuery <ReceiptWares>(SqlSetRefundedQuantity, parReceiptWares) > 0); } }
public virtual bool UpdateQuantityWares(ReceiptWares parIdReceiptWares) { lock (GetObjectForLockByIdWorkplace(parIdReceiptWares.IdWorkplace)) { return(this.db.ExecuteNonQuery(SqlUpdateQuantityWares, parIdReceiptWares) > 0 /*&& RecalcHeadReceipt(parParameters)*/); } }
public override bool FixWeight(ReceiptWares parIdReceipt) { using (var DB = new SQLite(ReceiptFile)) { return(DB.ExecuteNonQuery <ReceiptWares>(SqlSetFixWeight, parIdReceipt) > 0); } }
public override bool DeleteReceiptWares(ReceiptWares parIdReceiptWares) { using (var DB = new SQLite(ReceiptFile)) { return(DB.ExecuteNonQuery <IdReceiptWares>(SqlDeleteReceiptWares, parIdReceiptWares) > 0 /*&& RecalcHeadReceipt(parParameters)*/); } }
public override bool ReplaceWaresReceipt(ReceiptWares parReceiptWares) { using (var DB = new SQLite(ReceiptFile)) { return(DB.ExecuteNonQuery <ReceiptWares>(SqlReplaceWaresReceipt, parReceiptWares) > 0); } }
/// <summary> /// Повертає фактичну кількість після вставки(добавляє до текучої кількості - -1 якщо помилка; /// </summary> /// <param name="parParameters"></param> /// <returns></returns> public override bool AddWares(ReceiptWares parReceiptWares) { using (var DB = new SQLite(ReceiptFile)) { return(DB.ExecuteNonQuery <ReceiptWares>(SqlInsertWaresReceipt, parReceiptWares) > 0 /*&& RecalcHeadReceipt((IdReceipt)parReceiptWares)*/); } }
public ReceiptWares AddReceiptWares(ReceiptWares pW, bool pRecalcPriceOnLine = true) { bool isZeroPrice = false; lock (db.GetObjectForLockByIdWorkplace(pW.IdWorkplace)) { var Quantity = db.GetCountWares(pW); pW.QuantityOld = Quantity; pW.Quantity += Quantity; if (pW.AmountSalesBan > 0 && pW.Quantity > pW.AmountSalesBan && pW.CodeUnit != Global.WeightCodeUnit && pW.CodeUnit != Global.WeightCodeUnit) { pW.Quantity = pW.AmountSalesBan; if (Global.IsOldInterface) { isZeroPrice = true; return(null); } else { Global.OnClientWindows?.Invoke(pW.IdWorkplace, eTypeWindows.LimitSales, $"Даний товар {pW.NameWares} {Environment.NewLine} має обмеження в кількості {pW.AmountSalesBan} шт"); } } if (Quantity > 0) { db.UpdateQuantityWares(pW); } else { db.AddWares(pW); } } //Кешконтроль Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); // Get the elapsed time as a TimeSpan value. _ = VR.SendMessageAsync(pW.IdWorkplace, pW.NameWares, pW.Articl, pW.Quantity, pW.Sum); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; Console.WriteLine("\nVR=>" + ts.TotalMilliseconds + "\n"); if (pRecalcPriceOnLine && Global.RecalcPriceOnLine) { db.RecalcPriceAsync(pW); } /*if (pW.PLU > 0) * GenQRAsync(pW);*/ if (isZeroPrice) { pW.Price = 0; pW.PriceDealer = 0; } return(pW); }
public GW(ReceiptWares pFG) { Type = 0; Name = pFG.NameWares; Code = pFG.CodeWares; TotalRows = pFG.TotalRows; CodeUnit = pFG.CodeUnit; }
string XmlWares(ReceiptWares pRW) { string Add = (pRW.IsUseCodeUKTZED ? $"UKTZED={pRW.CodeUKTZED}" : "") + (!string.IsNullOrEmpty(pRW.ExciseStamp) ? " ExciseStamp=\"{pRW.ExciseStamp}\"" : "") + (!string.IsNullOrEmpty(pRW.BarCode) ? $" Barcode=\"{pRW.BarCode}\"" : ""); return($"<Good Code=\"{pRW.CodeWares}\" Name=\"{ToXMLString(pRW.NameWares) }\" Quantity=\"{pRW.Quantity}\" Price=\"{pRW.Price}\" Sum=\"{pRW.Sum}\" TaxRate=\"1\" {Add} />"); }
public override bool UpdateQR(ReceiptWares pRW) { using (var DB = new SQLite(ReceiptFile)) { return(DB.ExecuteNonQuery <ReceiptWares>(SqlUpdateQR, pRW) > 0); } //return true; }
public override bool SetWeight(Guid pTerminalId, Guid pProductId, decimal pWeight) { var CurReceipt = GetCurrentReceiptByTerminalId(pTerminalId); var RW = new ReceiptWares(CurReceipt, pProductId); RW.FixWeight = pWeight / 1000m; return(Bl.FixWeight(RW)); }
private void BtnClickMinusPlus(object sender, RoutedEventArgs e) { Button btn = sender as Button; if (btn.DataContext is ReceiptWares) { ReceiptWares temp = btn.DataContext as ReceiptWares; Bl.ChangeQuantity(temp, temp.Quantity + (btn.Name.Equals("Plus")?1:-1)); } }
public override bool UpdateQuantityWares(ReceiptWares parReceiptWares) { using (var DB = new SQLite(ReceiptFile)) { lock (GetObjectForLockByIdWorkplace(parReceiptWares.IdWorkplace)) { return(DB.ExecuteNonQuery(SqlUpdateQuantityWares, parReceiptWares) > 0 /*&& RecalcHeadReceipt(parParameters)*/); } } }
public RecordSKU(ReceiptWares pRW) : base(eTypeRecord.SKU) { SKU = pRW.CodeWares; UKTZED = pRW.CodeUKTZED; barcode = pRW.BarCode; if (!string.IsNullOrEmpty(pRW.ExciseStamp)) { excises = pRW.ExciseStamp.Split(','); } name = pRW.NameWares; price = pRW.PriceEKKA; quantity = pRW.Quantity; discountSum = pRW.DiscountEKKA; amount = pRW.Sum; vatGroup = Global.GetTaxGroup(pRW.TypeVat, pRW.TypeWares); codeUnit = pRW.CodeUnit; unitName = pRW.AbrUnit; }
private ReceiptWares GetReceiptWares(ProductViewModel varPWM) { if (varPWM == null) { return(null); } var Res = new ReceiptWares() { WaresId = varPWM.Id, CodeWares = varPWM.Code, NameWares = varPWM.Name, NameWaresReceipt = varPWM.AdditionalDescription, //!!!TMP; Price = varPWM.Price, Quantity = varPWM.Quantity, SumDiscount = varPWM.DiscountValue, // NameDiscount = varPWM.DiscountName, Sort = varPWM.TotalRows //Сортування популярного. }; return(Res); }
private void _ChangeCountWares(object sender, RoutedEventArgs e) { Background.Visibility = Visibility.Visible; BackgroundWares.Visibility = Visibility.Visible; KeyPad keyPad = new KeyPad(this); Button btn = sender as Button; if (btn.DataContext is ReceiptWares) { ReceiptWares temp = btn.DataContext as ReceiptWares; keyPad.productNameChanges.Text = Convert.ToString(temp.NameWares); keyPad.Result = Convert.ToString(temp.Quantity); if (keyPad.ShowDialog() == true) { temp.Quantity = Convert.ToDecimal(keyPad.Result); } Bl.ChangeQuantity(temp, temp.Quantity); Background.Visibility = Visibility.Collapsed; BackgroundWares.Visibility = Visibility.Collapsed; } }
public bool SaveReceipt(Receipt parReceipt, bool isRefund = true) { var ReceiptId = isRefund ? parReceipt.RefundId : (IdReceipt)parReceipt; var dbR = parReceipt.CodePeriod == Global.GetCodePeriod() ? db : new WDB_SQLite(ReceiptId.DTPeriod); dbR.ReplaceReceipt(parReceipt); dbR.ReplacePayment(parReceipt.Payment); var dbr = parReceipt.CodePeriod == parReceipt.CodePeriodRefund ? db : new WDB_SQLite(ReceiptId.DTPeriod); foreach (var el in parReceipt.Wares) { dbR.AddWares(el); if (isRefund) { var w = new ReceiptWares(ReceiptId, el.WaresId); w.Quantity = el.Quantity; dbr.SetRefundedQuantity(w); } } return(true); }
private ReceiptWares GetReceiptWaresFromReceiptItem(IdReceipt parIdReceipt, ReceiptItem receiptItem) { var Res = new ReceiptWares(parIdReceipt, receiptItem.ProductId) { //WaresId = receiptItem.ProductId, //CodeWares = receiptItem.Code, NameWares = receiptItem.ProductName, BarCode = receiptItem.ProductBarcode, PriceDealer = receiptItem.ProductPrice, Price = (receiptItem.FullPrice > 0 ? receiptItem.FullPrice : receiptItem.TotalPrice) / receiptItem.ProductQuantity, WeightBrutto = receiptItem.ProductWeight / 1000m, Quantity = receiptItem.ProductQuantity, // TaxGroup = Global.GetTaxGroup(receiptItem.TypeVat, receiptItem.TypeWares), //FullPrice = receiptItem.Sum RefundedQuantity = receiptItem.RefundedQuantity }; if (receiptItem.Excises != null) { Res.ExciseStamp = String.Join(",", receiptItem.Excises.ToArray()); } return(Res); }
// public ReceiptWares ReceiptWaresWait { get; set; } void SetWaitConfirm(eTypeAccess pTypeAccess, ReceiptWares pRW = null) { CurWares = pRW; TypeAccessWait = pTypeAccess; SetStateView(eStateMainWindows.WaitAdmin); }
public async Task <string> GetQrCoffe(ReceiptWares pReceiptWares, int pOrder, int pWait = 5) { var Url = "https://dashboard.prostopay.net/api/v1/qreceipt/generate"; string res = null; string Body = @"{ ""pos"":1, ""till"": {Kassa}, ""number"": {Order}, ""created-at"": 0, ""ttl"": 1, ""ttl-type"": 0, ""amount"": 100, ""amount-base"": 3, ""plu-from"": {PLU}, ""plu-to"": 0 }".Replace("{Order}", (++pOrder).ToString()).Replace("{PLU}", pReceiptWares.PLU.ToString()).Replace("{Kassa}", (pReceiptWares.IdWorkplace - 60).ToString()); List <ReceiptEvent> rr = new List <ReceiptEvent> { new ReceiptEvent(pReceiptWares) { EventType = ReceiptEventType.AskQR, EventName = Body, CreatedAt = DateTime.Now } }; try { HttpClient client = new HttpClient(); client.Timeout = TimeSpan.FromMilliseconds(pWait * 1000); HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Post, Url); requestMessage.Headers.Add("X-API-KEY", "98e071c0-7177-4132-b249-9244464c97fb"); requestMessage.Content = new StringContent(Body, Encoding.UTF8, "application/json"); var response = await client.SendAsync(requestMessage); if (response.IsSuccessStatusCode) { res = await response.Content.ReadAsStringAsync(); } else { Global.OnSyncInfoCollected?.Invoke(new SyncInformation { Exception = null, Status = eSyncStatus.NoFatalError, StatusDescription = "RequestAsync=>" + response.RequestMessage }); } } catch (Exception ex) { Global.OnSyncInfoCollected?.Invoke(new SyncInformation { TerminalId = Global.GetTerminalIdByIdWorkplace(pReceiptWares.IdWorkplace), Exception = ex, Status = eSyncStatus.NoFatalError, StatusDescription = "GetQrCoffe=>" + ex.Message + '\n' + new System.Diagnostics.StackTrace().ToString() }); rr.Add(new ReceiptEvent(pReceiptWares) { EventType = ReceiptEventType.ErrorQR, EventName = ex.Message, CreatedAt = DateTime.Now }); } res = res.Replace("\"", ""); rr.Add(new ReceiptEvent(pReceiptWares) { EventType = ReceiptEventType.AnswerQR, EventName = res, CreatedAt = DateTime.Now }); bl.db.InsertReceiptEvent(rr); return(res); }
public virtual bool DeleteReceiptWares(ReceiptWares parIdReceiptWares) { return(this.db.ExecuteNonQuery <IdReceiptWares>(SqlDeleteReceiptWares, parIdReceiptWares) > 0 /*&& RecalcHeadReceipt(parParameters)*/); }
public virtual bool ReplaceWaresReceipt(ReceiptWares parReceiptWares) { return(this.db.ExecuteNonQuery <ReceiptWares>(SqlReplaceWaresReceipt, parReceiptWares) > 0 /*&& RecalcHeadReceipt((IdReceipt)parReceiptWares)*/); }
public virtual bool UpdateQR(ReceiptWares pRW) { return(db.ExecuteNonQuery <ReceiptWares>(SqlUpdateQR, pRW) > 0); }
public virtual bool FixWeight(ReceiptWares parIdReceipt) { return(db.ExecuteNonQuery <ReceiptWares>(SqlSetFixWeight, parIdReceipt) > 0); }
public virtual bool SetRefundedQuantity(ReceiptWares parReceiptWares) { return(db.ExecuteNonQuery <ReceiptWares>(SqlSetRefundedQuantity, parReceiptWares) > 0); }
/// <summary> /// Convert MID.ReceiptWares->ProductViewModel /// </summary> /// <param name="receiptWares"></param> /// <returns></returns> private ProductViewModel GetProductViewModel(ReceiptWares receiptWares) { var LWI = new List <WeightInfo>(); if (receiptWares.IsWeight || receiptWares.WeightBrutto > 0) { LWI.Add( new WeightInfo() { Weight = (receiptWares.IsWeight ? Convert.ToDouble(receiptWares.Quantity) : Convert.ToDouble(receiptWares.WeightBrutto)), DeltaWeight = Convert.ToDouble(receiptWares.WeightDelta) + Convert.ToDouble(Global.GetCoefDeltaWeight( (receiptWares.IsWeight ? receiptWares.Quantity : receiptWares.WeightBrutto)) * (receiptWares.IsWeight ? receiptWares.Quantity : receiptWares.WeightBrutto)) } ); } if (!receiptWares.IsWeight && receiptWares.AdditionalWeights != null) { foreach (var el in receiptWares.AdditionalWeights) { LWI.Add(new WeightInfo { DeltaWeight = Convert.ToDouble(receiptWares.WeightDelta) + Convert.ToDouble(Global.GetCoefDeltaWeight(el)) * Convert.ToDouble(el), Weight = Convert.ToDouble(el) }); } } var varTags = (receiptWares.TypeWares > 0 || receiptWares.LimitAge > 0 || (!receiptWares.IsWeight && receiptWares.WeightBrutto == 0) || (receiptWares.WeightFact == -1) || (receiptWares.IsMultiplePrices)) ? new List <Tag>() : null; //!!!TMP // Різні мітки алкоголь, обмеження по часу. //Якщо алкоголь чи тютюн if (receiptWares.TypeWares > 0 || receiptWares.LimitAge > 0) { varTags.Add(new Tag() { Key = "AgeRestricted", Id = 0 }); } //Якщо алкоголь обмеження по часу if (receiptWares.TypeWares == 1) { varTags.Add(new Tag() { Key = "TimeRestricted", Id = 1, RuleValue = "{\"Start\":\"" + Global.AlcoholTimeStart + "\",\"Stop\":\"" + Global.AlcoholTimeStop + "\"}" }); } //Якщо алкоголь ввід Марки. if (receiptWares.TypeWares == 1) { varTags.Add(new Tag() { Key = "NeedExcise", Id = 2 }); } // Якщо немає ваги відключаємо її контроль if (!receiptWares.IsWeight && LWI.Count() == 0 && receiptWares.WeightFact != -1) { varTags.Add(new Tag { Id = 3, Key = "AutoAcceptRule" }); } // Товар не потрібно зважувати. FoodToGo if (receiptWares.WeightFact == -1) { varTags.Add(new Tag { Id = 4, Key = "DoNotUseScales" }); varTags.Add(new Tag { Id = 5, Key = "CanBeDeletedByCustomer" }); } if (receiptWares.IsMultiplePrices) { varTags.Add(new Tag { Id = 6, Key = "MultiplePrices", RuleValue = receiptWares.GetPrices }); } var Res = new ProductViewModel() { Id = receiptWares.WaresId, Code = receiptWares.CodeWares, Name = receiptWares.NameWares, AdditionalDescription = receiptWares.NameWaresReceipt, //!!!TMP; Image = null, Price = receiptWares.PriceEKKA, //(receiptWares.Priority==1? receiptWares.Price : (receiptWares.Price > receiptWares.PriceDealer ? receiptWares.Price : receiptWares.PriceDealer)), //receiptWares.SumDiscount > 0 ? receiptWares.PriceDealer : (receiptWares.Price > 0 ? receiptWares.Price : receiptWares.PriceDealer), //receiptWares.SumDiscount > 0 ? ( receiptWares.Price > 0 ? receiptWares.Price : receiptWares.PriceDealer): (receiptWares.Price>receiptWares.PriceDealer ? receiptWares.Price:receiptWares.PriceDealer), DiscountValue = receiptWares.DiscountEKKA, //= receiptWares.SumDiscount+ ( receiptWares.Priority == 1?0 : (receiptWares.PriceDealer > receiptWares.Price ? (receiptWares.PriceDealer * receiptWares.Quantity - receiptWares.Sum) : 0)), //receiptWares.SumDiscount > 0 ? receiptWares.SumDiscount : 0, //Global.RoundDown(receiptWares.SumDiscount>0 ? receiptWares.SumDiscount : (receiptWares.PriceDealer > receiptWares.Price ? (receiptWares.PriceDealer * receiptWares.Quantity - receiptWares.Sum):0)), WeightCategory = 2, //вимірювання Похибки в відсотках,2 в грамах Weight = (receiptWares.IsWeight ? Convert.ToDouble(receiptWares.Quantity) : (receiptWares.WeightBrutto == 0m ? 100000 : Convert.ToDouble(receiptWares.WeightBrutto))), DeltaWeight = Convert.ToDouble(receiptWares.WeightDelta) + Convert.ToDouble(Global.GetCoefDeltaWeight((receiptWares.IsWeight ? receiptWares.Quantity : receiptWares.WeightBrutto)) * (receiptWares.IsWeight ? receiptWares.Quantity : receiptWares.WeightBrutto)), AdditionalWeights = LWI, ProductWeightType = receiptWares.IsWeight ? ProductWeightType.ByWeight : ProductWeightType.ByBarcode, IsAgeRestrictedConfirmed = false, //Обмеження по віку алкоголь Підтверджено не потрібно посилати. Quantity = (receiptWares.IsWeight ? 1 : receiptWares.Quantity), DiscountName = receiptWares.GetStrWaresReceiptPromotion, WarningType = null, //!!! Не посилати Tags = varTags, HasSecurityMark = false, //!!!TMP // Магнітна мітка, яку треба знімати. TotalRows = receiptWares.TotalRows, //Сортування популярного. IsProductOnProcessing = false, // ///CategoryId= !!!TMP Групи 1 рівня. TaxGroup = Global.GetTaxGroup(receiptWares.TypeVat, receiptWares.TypeWares), Barcode = receiptWares.TypeWares > 0 ? receiptWares.BarCode : null, //FullPrice = receiptWares.Sum RefundedQuantity = receiptWares.RefundedQuantity, CalculatedWeight = Convert.ToDouble(receiptWares.FixWeight * 1000) , Uktzed = receiptWares.TypeWares > 0 ? receiptWares.CodeUKTZED : null , IsUktzedNeedToPrint = receiptWares.IsUseCodeUKTZED , Excises = receiptWares.ExciseStamp?.Split(',').ToList() }; return(Res); }
public bool FixWeight(ReceiptWares pRW) { return(db.FixWeight(pRW)); }