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(); }
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); }
private void NewProcess() { CurrentOperation = Operations.Process; var autorizacion = SalesDetailsCollection.ToList().Any(dc => dc.PriceEdited); if (!UserIsValid && autorizacion) { ShowUserValidatorPicker(); return; } IsBusy = IsDetailsBusy = true; if (SalesHelper.VerifyNumAtCard(SelectedSale)) { if (!ShowWarningMessage("Numero de Factura Repetido, Desea continuar de todas formas ?")) { IsBusy = IsDetailsBusy = false; return; } } if (!ConfirmDialog("Desea procesar la venta?", "procesar")) { UndoChanges(); IsBusy = IsDetailsBusy = false; return; } ViewModelManager.CloseModal(); ShowProcessLoader(this); AsyncHelper.DoAsync(() => { if (!Exento && !WithHolding) { CheckIVACOM(true); } else { CheckIVAEXE(Exento); CheckIVARET(WithHolding); } //SelectedSale.StateL = LocalStatus.Pendiente; SalesHelper.AddSale(SelectedSale); if (HasDownPayment && SelectedDownPayment != null) { SelectedDownPayment = SelectedDownPayment.ForceUpdateToDataBase(); SelectedDownPayment.IdSaleL = SelectedSale.IdSaleL; } else if (SelectedDownPayment != null) { SelectedDownPayment.IdSaleL = null; } SaveChanges(); CheckBookHelper.SetNextCheckBookNumber((int)SelectedSale.Series, Convert.ToInt32(selectedSale.NumAtCard)); Synchronization.Synchronize(SelectedSale); IsBusy = IsDetailsBusy = false; SaveChanges(); RefreshItemSource(); }, ViewModelManager.CloseProcessLoader); }
private void SaveNewDetails() { CurrentOperation = Operations.Save; var autorizacion = SalesDetailsCollection.ToList().Any(dc => dc.PriceEdited); if (!UserIsValid && autorizacion) { ShowUserValidatorPicker(); return; } if (SalesHelper.VerifyNumAtCard(SelectedSale)) { if (ShowWarningMessage("Numero de Factura Repetido, Desea continuar de todas formas ?")) { return; } IsBusy = IsDetailsBusy = false; return; } if (!ConfirmDialog("Desea Guardar Los Cambios", "Guardar")) { UndoChanges(); return; } // Excluir articulos no inventariables. var productsToExclude = ArticlesHelper.GetProductsOnInventory(SalesDetailsCollection.Select(d => d.ItemCode).ToList()); //.Where(p=> p.OITM_Articles.InvntItem.Contains("Y")) var isnotValid = SalesDetailsCollection.Where(p => !productsToExclude.Contains(p.ItemCode)) .Any(d => { if (d.Quantity > d.OnHand) { ErrorMessage = string.Format("El Articulo : {0} Codigo {1} ,Quedara en Negativo", d.Dscription, d.ItemCode); ShowErrorMessageBox(ErrorMessage); return(true); } ErrorMessage = string.Empty; return(false); }); if (isnotValid) { return; } if (!Exento && !WithHolding) { CheckIVACOM(true); } else { CheckIVAEXE(Exento); CheckIVARET(WithHolding); } if (!HasDownPayment) { SelectedSale.dpEntry = 0; } SalesHelper.AddSale(SelectedSale); //if (SelectedDownPayment != null) //{ // if (HasDownPayment) SelectedDownPayment.IdSaleL = SelectedSale.IdSaleL; else SelectedDownPayment.IdSaleL = null; //} SaveChanges(); // TODO validar los valores Series y NumAtCard son diferentes de null , //y considerar el caso en que los valores son 0 if (SelectedSale == null) { return; // TODO Show error Message } var serieNumber = (int)(SelectedSale.Series.HasValue? SelectedSale.Series : 0); var numAtcoard = !string.IsNullOrEmpty(SelectedSale.NumAtCard) ? Convert.ToInt32(SelectedSale.NumAtCard) : 0; CheckBookHelper.SetNextCheckBookNumber(serieNumber, numAtcoard); ViewModelManager.CloseModal(); RefreshItemSource(); }