private void RecibeDatosTarj(DataTable Datos) { try { foreach (DataRow fila in Datos.Rows) { var BL = new tb_t1_tarjetaBL(); var BE = new tb_t1_tarjeta(); var dt = new DataTable(); BE.filtro = "2"; BE.tarjetaid = Convert.ToInt32(fila["tarjetaid"].ToString()); dt = BL.GetAll2(VariablesPublicas.EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { row = TablaTarjetas.NewRow(); row["tarjetaid"] = Datos.Rows[0]["tarjetaid"].ToString(); row["tarjetaimpo"] = Datos.Rows[0]["tarjetaimpo"].ToString(); row["tarjetanume"] = Datos.Rows[0]["tarjetanume"].ToString(); row["tarjetaname"] = dt.Rows[0]["tarjetaname"].ToString(); row["tarjetalogo"] = dt.Rows[0]["tarjetalogo"]; row["ddnni"] = Datos.Rows[0]["ddnni"].ToString(); } TablaTarjetas.Rows.Add(row); } dgbtarjetas.DataSource = TablaTarjetas; if (TablaTarjetas != null) { if (TablaTarjetas.Rows.Count != 0) { importtarj.Text = Convert.ToDecimal(TablaTarjetas.Compute("sum(tarjetaimpo)", string.Empty)).ToString("##,###,##0.00"); } else { importtarj.Text = "0"; } } else { importtarj.Text = "0"; } //calcularVuelto(); } catch (Exception ex) { throw ex; } }
private void Cargar_ComboTarjeta() { try { var BL = new tb_t1_tarjetaBL(); var BE = new tb_t1_tarjeta(); var ds = new DataSet(); BE.filtro = "2"; ds = BL.GetAll2(VariablesPublicas.EmpresaID, BE); var dvm = new DataViewManager(ds); DataView dvDropDown; dvDropDown = dvm.CreateDataView(ds.Tables[0]); glueTarjeta.Properties.View.OptionsBehavior.AutoPopulateColumns = false; glueTarjeta.Properties.DataSource = dvDropDown; glueTarjeta.Properties.DisplayMember = "tarjetaname"; glueTarjeta.Properties.ValueMember = "tarjetaid"; var col1 = glueTarjeta.Properties.View.Columns.AddField("tarjetalogo"); col1.VisibleIndex = 0; col1.Caption = "logo"; col1.Width = 20; var col2 = glueTarjeta.Properties.View.Columns.AddField("tarjetaname"); col2.VisibleIndex = 1; col2.Caption = "Nombre de Tarjeta"; col2.Width = 100; glueTarjeta.Properties.PopupFormWidth = 1; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void data_TablaTarjeta() { try { if (TablaTarjeta.Rows.Count > 0) TablaTarjeta.Rows.Clear(); tb_t1_tarjetaBL BL = new tb_t1_tarjetaBL(); tb_t1_tarjeta BE = new tb_t1_tarjeta(); BE.tarjetaname = txt_criterio.Text.Trim().ToUpper(); TablaTarjeta = BL.GetAll2(EmpresaID, BE).Tables[0]; if (TablaTarjeta.Rows.Count > 0) { btn_imprimir.Enabled = true; gridTarjeta.DataSource = TablaTarjeta; gridTarjeta.Rows[0].Selected = false; gridTarjeta.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }