private void RecalculateBasket(bool rebindPaymentForms) { //UPDATE SHIPPING RATES if (DelieveryMethodsPanel.Visible) { int shipmentIndex = 0; foreach (RepeaterItem item in ShipmentsRepeater.Items) { BasketShipment shipment = _basket.Shipments[shipmentIndex]; DropDownList ShipMethodList = (DropDownList)item.FindControl("ShipMethodList"); if (ShipMethodList != null) { shipment.ShipMethodId = AlwaysConvert.ToInt(ShipMethodList.SelectedValue); shipment.Save(); } shipmentIndex++; } } //RECALCULATE SHIPPING, TAXES, DISCOUNTS, ETC. _basketService.Recalculate(_basket); _CurrentBasketHash = _basket.GetContentHash(OrderItemType.Product); if (rebindPaymentForms) { PaymentWidget.DataBind(); } }
public EditNewAdvancePayment(Partner partner, BasePaymentType?paymentType = null, bool alwaysReceive = false) { this.partner = partner; this.alwaysReceive = alwaysReceive; this.paymentType = paymentType ?? BusinessDomain.AppConfiguration.LastPaymentMethod; paymentWidget = new PaymentWidget(payments, PriceType.SaleTotal); Initialize(); debt = Partner.GetDebt(partner.Id); lblDebtValue.SetText(Currency.ToString(Math.Abs(debt))); lblDebt.SetText(debt < 0 ? Translator.GetString("We owe:") : Translator.GetString("Debt:")); if (Partner.GetDuePayments(partner.Id).Length > 0) { paymentWidget.Received = Math.Abs(debt); } else { this.alwaysReceive = true; } ArrangePaymentWidget(); chkPrintCashReceipt.Sensitive = BusinessDomain.AppConfiguration.CashReceiptPrinterEnabled; }
public EditNewPayment(Operation operation, BasePaymentType?paymentType = null, bool printFiscal = false) { this.operation = operation; if (this.operation.Id <= 0) { this.operation.Payments.Clear(); } total = Currency.Round(operation.TotalPlusVAT, operation.TotalsPriceType); this.paymentType = paymentType ?? BusinessDomain.AppConfiguration.LastPaymentMethod; paymentWidget = new PaymentWidget(payments, operation.TotalsPriceType); paymentWidget.PaymentDeleted += (sender, e) => RecalculateChange(paymentWidget.Received); paymentWidget.ValueChanged += (sender, e) => RecalculateChange(e.Value); Initialize(); ArrangePaymentWidget(); chkChangeIsReturned.Visible = operation.UseChange; ICashReceiptPrinterController cashReceiptPrinter = BusinessDomain.DeviceManager.CashReceiptPrinterDriver; object hasFiscalMemory; chkPrintCashReceipt.Sensitive = cashReceiptPrinter != null && operation.AllowFiscal && (operation.Id < 0 || (cashReceiptPrinter.GetAttributes().TryGetValue(DriverBase.HAS_FISCAL_MEMORY, out hasFiscalMemory) && (bool)hasFiscalMemory == false)); chkPrintCashReceipt.Visible = BusinessDomain.WorkflowManager.AllowSaleWithoutReceipt; chkPrintCashReceipt.Active = !BusinessDomain.WorkflowManager.AllowSaleWithoutReceipt || (chkPrintCashReceipt.Sensitive && printFiscal); chkPrintDocument.Sensitive = BusinessDomain.AppConfiguration.IsPrintingAvailable(); }