/// <summary> /// AGREGAR ARTICULO /// </summary> public void AddArticle() { try { using (var oForm = new xfSearchArticleSales(SESSION_COMP)) { if (oForm.ShowDialog() == DialogResult.OK) { //if (oForm.oBe.ALF_CODI_ARTI.ToUpper().Equals("SERVICIO")) // throw new ArgumentException("Solo se puede agregar servicio"); var oBe = new BESVTD_COTI(); oBe.COD_ARTI = oForm.oBe.COD_ARTI; oBe.ALF_CODI_ARTI = oForm.oBe.ALF_CODI_ARTI; oBe.ALF_ARTI = oForm.oBe.ALF_ARTI; oBe.NUM_PREC_UNIT = oForm.oBe.NUM_PREC; oBe.NUM_PORC_DESC = oForm.oBe.NUM_DESC; oBe.NUM_DESC = oBe.NUM_PREC_UNIT * oForm.oBe.NUM_DESC; oBe.NUM_CANT = 1; oBe.NUM_IMPO = oBe.NUM_CANT * (oBe.NUM_PREC_UNIT - (oBe.NUM_PREC_UNIT * oForm.oBe.NUM_DESC)); oListArti.Add(oBe); ListArticleCompletedUpdate(); gdvArticlesCompleted.RefreshData(); gdvArticles.RefreshData(); txtNUM_SUBT.Text = (oListArti.Sum(obj => obj.NUM_IMPO) + oListArtiGroup.Sum(obj => obj.NUM_IMPO)).ToString("#,##0.00"); txtNUM_IGVV.Text = (Convert.ToDecimal(txtNUM_SUBT.Text) * (chkIGV.Checked ? SESSION_PORC_IMPU : Convert.ToDecimal("0.00"))).ToString("#,##0.00"); txtNUM_TOTA.Text = (Convert.ToDecimal(txtNUM_SUBT.Text) + Convert.ToDecimal(txtNUM_IGVV.Text)).ToString("#,##0.00"); ALF_TOTA(Convert.ToDecimal(txtNUM_TOTA.Text)); } } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void AddArticle() { try { var obr = new BRPurchase(); var TIPO_CAMB = obr.Get_PSGN_SPLS_SVMC_TIPO_CAMB(SESSION_COMP, 1); using(var oForm = new xfSearchArticleSales(SESSION_COMP)) { if (oForm.ShowDialog() == DialogResult.OK) { var oBe = new BESVTD_COTI(); oBe.COD_ARTI = oForm.oBe.COD_ARTI; oBe.ALF_CODI_ARTI = oForm.oBe.ALF_CODI_ARTI; oBe.ALF_ARTI = oForm.oBe.ALF_ARTI; if (lueCOD_MONE.EditValue.ToString().Equals("2")) { oBe.NUM_PREC_UNIT = oForm.oBe.NUM_PREC; } else { oBe.NUM_PREC_UNIT = Math.Round(oForm.oBe.NUM_PREC*TIPO_CAMB,2); } oBe.NUM_PORC_DESC = Convert.ToDecimal(txtNUM_DESC.Text.Replace("%", "")); oBe.NUM_DESC = oBe.NUM_PREC_UNIT * decimal.Round((oBe.NUM_PORC_DESC/decimal.Parse("100.00")),2); oBe.NUM_CANT = 1; oBe.NUM_IMPO = oBe.NUM_CANT * (oBe.NUM_PREC_UNIT - (oBe.NUM_PREC_UNIT * decimal.Round((oBe.NUM_PORC_DESC / decimal.Parse("100.00")), 2))); oListArti.Add(oBe); gdvArticles.RefreshData(); txtNUM_SUBT.Text = (oListArti.Sum(obj => obj.NUM_IMPO) + oListArtiGroup.Sum(obj => obj.NUM_IMPO)).ToString("#,##0.00"); txtNUM_IGVV.Text = (Convert.ToDecimal(txtNUM_SUBT.Text) * (chkIGV.Checked?SESSION_PORC_IMPU:Convert.ToDecimal("0.00"))).ToString("#,##0.00"); txtNUM_TOTA.Text = (Convert.ToDecimal(txtNUM_SUBT.Text) + Convert.ToDecimal(txtNUM_IGVV.Text)).ToString("#,##0.00"); ALF_TOTA(Convert.ToDecimal(txtNUM_TOTA.Text)); } } } catch (Exception ex) { XtraMessageBox.Show(ex.Message,"Sistema",MessageBoxButtons.OK,MessageBoxIcon.Error); } }