public override void ExecuteEdit() { ErrorMessage = string.Empty; SalesDetailsCollection = null; RaisePropertyChanged("SelectedSale"); if (SelectedSale != null) { UserIsValid = false; SelectedPartner = BusinessPartnerHelper.GetBusinessPartner(SelectedSale.CardCode); SelectedDownPayment = DownPaymentHelper.GetDownPaymentInSale(SelectedSale, asNotrack: true); HasDownPayment = SelectedDownPayment != null; Exento = SelectedSale.INV1_SalesDetail.Any(d => d.TaxCode == Config.IVAEXE); WithHolding = !Exento && SelectedSale.INV1_SalesDetail.Any(d => d.TaxCode == Config.IVARET); serie = SeriesHelper.GetSerie(selectedSale.Series); RaisePropertyChanged("Serie"); IsRoyality(); // Para actualizar existencias. var itemCodes = SelectedSale.INV1_SalesDetail.Select(d => d.ItemCode).ToList(); var inventory = ArticlesHelper.GetSalesArticles(itemCodes); SelectedSale.INV1_SalesDetail.ToList().ForEach(d => { var product = inventory.FirstOrDefault(p => p.ItemCode == d.ItemCode); if (product != null) { d.OnHand = ArticlesHelper.GetOnHandFor(product.ItemCode); // GetOnHandFromProduct(product); } }); } FormTitle = "Detalle de Venta " + SelectedSale.DocNum; ShowDialog(new SaleDetailsView(), this, resizeMode: ResizeMode.CanResize); }
private void SaveNewDetails() { if (ConfirmDialog("Desea Guardar los Cambios", "Guardar")) { // issue resolved Factura consumidor final no tiene cuenta contable. if (serie.SeriesName == "ANC") { SelectedDownPayment.CardCode = SelectedPartner.CardCode; } if (SelectedDownPayment.IdDownPayment == 0) { DownPaymentHelper.Add(SelectedDownPayment); } DownPaymentDetail.WhsCode = SelectedDownPayment.WhsCode; DownPaymentDetail.AcctCode = Config.DownPaymentAcc; DownPaymentDetail.TaxCode = SelectedDownPayment != null && SelectedDownPayment.Series == 31 ? Config.IVACOF : "IVACRF"; SelectedDownPayment.DocTotal = (decimal)DownPaymentDetail.Price; SelectedDownPayment.PaymentAcc = SelectedDownPayment.PaymentType.AcctCode; if (DownPaymentDetail.IdDownPaymentL == 0) { SelectedDownPayment.DPI1_DownPaymentDetail.Add(DownPaymentDetail); } SaveChanges(); } else { UndoChanges(); } CheckBookHelper.SetNextCheckBookNumber(SelectedDownPayment.Series, SelectedDownPayment.NumAtCard, onErrorAction: ShowErrorMessageBox); ForceRefresh = true; RaisePropertyChanged("DownPaymentCollection"); ViewModelManager.CloseModal(); }
public override void ExecuteDelete() { if (SelectedDownPayment == null || !ConfirmDelete()) { return; } DownPaymentHelper.Delete(SelectedDownPayment); SaveChanges(); DownPaymentCollection.Remove(SelectedDownPayment); }
public static ODPI_DownPayment Synchronize(ODPI_DownPayment model) { CheckForUpdates();// Actualizar cambios antes de subir y verificar si el objeto no fue ya procesado model = DownPaymentHelper.Get(model.IdDownPayment); if (model.StateL != LocalStatus.Procesado) { return(model.Upload(SyncUpload)); } else { return(model); } }
private void NewProcess() { DownPaymentHelper.Add(SelectedDownPayment); IsBusy = true; var confirmed = ConfirmDialog("Desea guardar y procesar los Cambios", "Procesar"); ShowProcessLoader(this); AsyncHelper.DoAsync(() => { if (confirmed) { if (SelectedDownPayment.IdDownPayment == 0) { // issue resolved Factura consumidor final no tiene cuenta contable. if (serie.SeriesName == "ANC") { SelectedDownPayment.CardCode = SelectedPartner.CardCode; } //SelectedDownPayment.StateL = LocalStatus.Pendiente; DownPaymentDetail.WhsCode = SelectedDownPayment.WhsCode; DownPaymentDetail.AcctCode = Config.DownPaymentAcc; DownPaymentDetail.TaxCode = SelectedDownPayment != null && SelectedDownPayment.Series == 31 ? Config.IVACOF : "IVACRF"; if (DownPaymentDetail != null && DownPaymentDetail.Price.HasValue) { SelectedDownPayment.DocTotal = (decimal)DownPaymentDetail.Price; } SelectedDownPayment.DPI1_DownPaymentDetail.Add(DownPaymentDetail); SaveChanges(); CheckBookHelper.SetNextCheckBookNumber((int)SelectedDownPayment.Series, Convert.ToInt32(SelectedDownPayment.NumAtCard)); SaveChanges(); } } else { UndoChanges(); } Synchronization.Synchronize(SelectedDownPayment); IsBusy = false; SaveChanges(); RefreshItemSource(); }, ViewModelManager.CloseProcessLoader); }