public DataSet GetAll(string empresaid, tb_co_rubroventas BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoRubroventas_SEARCH", cnx)) { DataSet ds = new DataSet(); { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@rubroid", SqlDbType.Char, 4).Value = BE.rubroid; cmd.Parameters.Add("@rubroname", SqlDbType.VarChar, 100).Value = BE.rubroname; cmd.Parameters.Add("@cuentaid", SqlDbType.Char, 10).Value = BE.cuentaid; cmd.Parameters.Add("@cuentaname", SqlDbType.VarChar, 100).Value = BE.cuentaname; cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public bool Delete(string empresaid, tb_co_rubroventas BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoRubroventas_DELETE", cnx)) { { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@rubroid", SqlDbType.Char, 4).Value = BE.rubroid; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public DataSet GetAll_IR(string empresaid, tb_co_rubroventas BE) { //return tablaDA.GetAll_IR(empresaid, BE); DataSet xreturn = null; xreturn = tablaDA.GetAll_IR(empresaid, BE); Sql_Error = tablaDA.Sql_Error; return xreturn; }
public void ValidarubroVenta() { string xcodigo = ""; sw_novaluechange = true; if (object.ReferenceEquals(GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["rubroid"].Value, DBNull.Value)) { GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["rubroid"].Value = ""; } xcodigo = Equivalencias.Mid(GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["rubroid"].Value.ToString(), 1, 4); if (xcodigo.Trim().Length > 0) { xcodigo = VariablesPublicas.PADL(xcodigo.Trim(), 4, "0"); try { tb_co_rubroventasBL BL = new tb_co_rubroventasBL(); tb_co_rubroventas BE = new tb_co_rubroventas(); BE.rubroid = xcodigo; tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; } catch (Exception ex) { DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (tmptabla.Rows.Count > 0) { GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["rubroid"].Value = tmptabla.Rows[0]["rubroid"]; GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["drubro"].Value = tmptabla.Rows[0]["rubroname"]; txtDescripcampo.Text = tmptabla.Rows[0]["cuentaid"].ToString().Trim() + " - " + tmptabla.Rows[0]["cuentaname"].ToString().Trim(); } else { GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["rubroid"].Value = j_RUBRO; } } else { GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["rubroid"].Value = j_RUBRO; } sw_novaluechange = false; }
private bool Validacion() { object xobjeto = null; int lc_cont = 0; string xmsgstring = ""; DataTable tmptabla = new DataTable(); dynamic xfill = "..."; if (txtNumero.Text.Trim().Length == 0) { xmsgstring = xmsgstring + "\r\n" + "Ingrese Número de Comprobante...?"; xobjeto = txtNumero; } //if (txtNumFin.Text.Trim().Length == 0) //{ // xmsgstring = xmsgstring + "\r\n" + "Ingrese Número de Comprobante Final...?"; // xobjeto = txtNumFin; //} if (txtRuc.Text.Trim().Length == 0) { xmsgstring = xmsgstring + "\r\n" + "Ingrese Cliente...?"; xobjeto = txtRuc; } else { try { clienteBL BL = new clienteBL(); tb_cliente BE = new tb_cliente(); BE.nmruc = txtRuc.Text; if ((BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]).Rows.Count == 0) { xmsgstring = (xmsgstring + ("\r\n" + "Cliente no existe...?")); xobjeto = txtRuc; } } catch (Exception ex) { DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (txtTipoventa.Text.Trim().Length == 0) { xmsgstring = xmsgstring + "\r\n" + "Ingrese Tipo Venta...?"; xobjeto = txtTipoventa; } else { } Decimal vmntipocambio = VariablesPublicas.StringtoDecimal(txtTipocambio.Text); if (vmntipocambio == 0) { xmsgstring = xmsgstring + "\r\n" + "Ingrese Tipo de Cambio...?"; xobjeto = fRegistro; } if (validaduplicidad()) { xmsgstring = xmsgstring + xfill; } if ((txtGlosa.Text.Trim()).Trim().Length == 0) { xmsgstring = xmsgstring + "\r\n" + "Ingrese glosa...?"; xobjeto = txtGlosa; } string xcodtmp = ""; string xcodtmpr = ""; double canttmp = 0; DataTable otabla = new DataTable(); if (DetFacturacion.Rows.Count == 0) { xmsgstring = xmsgstring + "\r\n" + "Ingrese detalles al movimiento...?"; xobjeto = GridExaminar; } if (xmsgstring.Trim().Length == 0) { for (lc_cont = 0; lc_cont <= DetFacturacion.Rows.Count - 1; lc_cont++) { // Validando Rubro xcodtmp = ""; if (!object.ReferenceEquals(DetFacturacion.Rows[lc_cont]["rubroid"], DBNull.Value)) { xcodtmpr = DetFacturacion.Rows[lc_cont]["rubroid"].ToString(); } if (xcodtmpr.Trim().Length == 0) { xcodtmpr = "..."; } if (xcodtmpr.Trim().Length > 0) { try { tb_co_rubroventasBL BL = new tb_co_rubroventasBL(); tb_co_rubroventas BE = new tb_co_rubroventas(); BE.rubroid = xcodtmpr; tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (tmptabla.Rows.Count == 0) { xmsgstring = (xmsgstring + ("\r\n" + "Rubro de Ventas no Existe...?")); xobjeto = GridExaminar; } if (tmptabla.Rows.Count > 0) { if (tmptabla.Rows[0]["cuentaid"].ToString().Trim().Length != 7) { xmsgstring = (xmsgstring + ("\r\n" + "Rubro no Asociado a una Cuenta Contable Válida...?")); xobjeto = GridExaminar; } } } catch (Exception ex) { DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } // Validando Item if (!object.ReferenceEquals(DetFacturacion.Rows[lc_cont]["productid"], DBNull.Value)) { xcodtmp = DetFacturacion.Rows[lc_cont]["productid"].ToString(); } else { xcodtmp = ""; } if (xcodtmp.Trim().Length > 0) { try { tb_pt_productoBL BL = new tb_pt_productoBL(); tb_pt_producto BE = new tb_pt_producto(); BE.productid = xcodtmp; otabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (otabla.Rows.Count == 0) { xmsgstring = "Código de Artículo no existe...?"; xobjeto = GridExaminar; } } catch (Exception ex) { DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } // Validando Precios if (!object.ReferenceEquals(DetFacturacion.Rows[lc_cont]["precunit"], DBNull.Value)) { canttmp = Convert.ToDouble(DetFacturacion.Rows[lc_cont]["precunit"]); } else { canttmp = 0; } if (canttmp <= 0) { xmsgstring = xmsgstring + "\r\n" + "Ingrese precio...?"; xobjeto = GridExaminar; } if (!object.ReferenceEquals(DetFacturacion.Rows[lc_cont]["cantidad"], DBNull.Value)) { canttmp = Convert.ToDouble(DetFacturacion.Rows[lc_cont]["cantidad"]); } else { canttmp = 0; } if (canttmp <= 0) { xmsgstring = xmsgstring + "\r\n" + "Ingrese Cantidades...?"; xobjeto = GridExaminar; } // Validando Centro de Costo DataTable tmptablarelacionccosto = new DataTable(); string vmccosto; vmccosto = "..."; if (!(DetFacturacion.Rows[lc_cont]["cencosid"] == DBNull.Value)) { if (DetFacturacion.Rows[lc_cont]["cencosid"].ToString().Trim().Length > 0) { vmccosto = DetFacturacion.Rows[lc_cont]["cencosid"].ToString(); } } try { centrocostoBL BL = new centrocostoBL(); tb_centrocosto BE = new tb_centrocosto(); if (xcodtmpr != "...") { BE.cencosdivi = Equivalencias.Mid(tmptabla.Rows[0]["cuentaid"].ToString(), 1, 1); tmptablarelacionccosto = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; } if (tmptablarelacionccosto.Rows.Count > 0) { int qqqcont; bool zhalladoccosto = false; for (qqqcont = 0; (qqqcont <= (tmptablarelacionccosto.Rows.Count - 1)); qqqcont++) { if (tmptablarelacionccosto.Rows[qqqcont]["cencosid"].ToString() == vmccosto) { zhalladoccosto = true; break; } } if (!zhalladoccosto) { xmsgstring = (xmsgstring + ("\r\n" + "Centro de Costo no asociado al Rubro...?")); } else { for (qqqcont = 0; (qqqcont <= (GridExaminar.Rows.Count - 1)); qqqcont++) { if (GridExaminar.Rows[qqqcont].Cells["asientoitems"].Value == DetFacturacion.Rows[lc_cont]["asientoitems"]) { if (GridExaminar.CurrentCell == null) { GridExaminar.CurrentCell = GridExaminar.Rows[qqqcont].Cells["rubroid"]; } GridExaminar.CurrentCell.ReadOnly = true; GridExaminar.CurrentCell = GridExaminar.Rows[qqqcont].Cells["cencosid"]; GridExaminar.BeginEdit(true); GridExaminar.CurrentCell.ReadOnly = false; break; } } } } } catch (Exception ex) { DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if ((xmsgstring.Trim().Length > 0)) { break; } } } if (xmsgstring.Trim().Length == 0) { if (u_n_opsel == 1 | (W_KEY0001 != txtRuc.Text + cboTipdoc.SelectedValue + txtSerie.Text + txtNumero.Text)) { tmptabla = null; try { tb_co_VentascabBL BL = new tb_co_VentascabBL(); tb_co_Ventascab BE = new tb_co_Ventascab(); BE.nmruc = txtRuc.Text; BE.tipdoc = cboTipdoc.SelectedValue.ToString(); BE.serdoc = txtSerie.Text; BE.numdoc = txtNumero.Text; tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (!(tmptabla == null)) { if (tmptabla.Rows.Count > 0) { xmsgstring = ("Documento Ya registrado en Periodo : " + tmptabla.Rows[0]["perianio"] + " Registro Nº " + tmptabla.Rows[0]["diarioid"] + "/" + tmptabla.Rows[0]["perimes"] + "-" + tmptabla.Rows[0]["asiento"]); xobjeto = txtNumero; } } } catch (Exception ex) { DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } if (xobjeto != null) { try { xobjeto = Focus(); } catch (Exception ex) { DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (xmsgstring.Trim().Length > 0 & xmsgstring.Trim() != xfill) { DevExpress.XtraEditors.XtraMessageBox.Show(xmsgstring, "Validación de Datos", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (xmsgstring.Trim().Length == 0) { if (!PuedeEditarEliminar("Grabar Nuevo Registro", VariablesPublicas.PADL(fRegistro.Value.Month.ToString(), 2, "0"))) { xmsgstring = "..."; } } if (xmsgstring.Trim().Length == 0) { return VariablesPublicas.U_ValidaFechaRegistroProvision(VariablesPublicas.perianio, txtMes.Text, fRegistro.Value); } else { return xmsgstring.Trim().Length == 0; } }
private void validaCentroCosto() { DataTable tmpccosto = new DataTable(); sw_novaluechange = true; Int16 lc_cont; bool zhallado = false; string VMNROITEM = GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["asientoitems"].Value.ToString(); string xcodartic = ".."; string xcodrubro = "...."; if (!(GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["rubroid"].Value == DBNull.Value)) { xcodrubro = GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["rubroid"].Value.ToString(); tb_co_rubroventasBL BL = new tb_co_rubroventasBL(); tb_co_rubroventas BE = new tb_co_rubroventas(); BE.rubroid = xcodrubro; tmpccosto = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; } string xcodcuenta = ".."; xcodcuenta = ""; if (tmpccosto.Rows.Count > 0) { xcodcuenta = Equivalencias.Mid(tmpccosto.Rows[0]["cuentaid"].ToString(), 1, 2); } if (!(GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["cencosid"].Value == DBNull.Value)) { xcodartic = GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["cencosid"].Value.ToString(); } if (xcodartic.Trim().Length == 0) { // DetFacturacion.Rows[lc_cont]["cencosid"] = ""; // DetFacturacion.Rows[lc_cont]["dccosto"] = ""; zhallado = true; } else { centrocostoBL BL = new centrocostoBL(); tb_centrocosto BE = new tb_centrocosto(); BE.cencosid = xcodartic; tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; for (lc_cont = 0; lc_cont < DetFacturacion.Rows.Count; lc_cont++) { if (DetFacturacion.Rows[lc_cont]["asientoitems"].ToString() == VMNROITEM) { if (tmptabla.Rows.Count > 0) { DetFacturacion.Rows[lc_cont]["cencosid"] = tmptabla.Rows[0]["cencosid"]; // DetFacturacion.Rows[lc_cont]["dccosto"] = Equivalencias.Mid(tmptabla.Rows[0]["descrip_a"], 1, DetFacturacion.Columns["dccosto"].MaxLength); txtDescripcampo.Text = tmptabla.Rows[0]["cencosname"].ToString(); zhallado = true; break; } } } } if (!zhallado) { GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["cencosid"].Value = j_Ccosto; } GridExaminar.Refresh(); sw_novaluechange = false; }
private void AyudaCentroCosto() { string xcodrubro = ""; string xcodcuenta = ""; if (GridExaminar.CurrentRow != null) { if (!(GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["rubroid"].Value == DBNull.Value)) { xcodrubro = GridExaminar.Rows[GridExaminar.CurrentRow.Index].Cells["rubroid"].Value.ToString(); tb_co_rubroventasBL BL = new tb_co_rubroventasBL(); tb_co_rubroventas BE = new tb_co_rubroventas(); BE.rubroid = xcodrubro; tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (tmptabla.Rows.Count > 0) { xcodcuenta = Equivalencias.Mid(tmptabla.Rows[0]["cuentaid"].ToString(), 1, 2); } else { xcodcuenta = "..."; } } } Ayudas.Frm_AyudaCentrocosto frmayuda = new Ayudas.Frm_AyudaCentrocosto(); frmayuda.Owner = this; frmayuda.Owner = this; frmayuda._ClaseCuenta = xcodcuenta; frmayuda.PasaCentroCosto = RecibeCcosto; frmayuda.ShowDialog(); }
private void POnerDatos() { var xCuenta = string.Empty; if (txtCuenta.Enabled) { xCuenta = txtCuenta.Text; } var xRubro = string.Empty; if (txtRubro.Enabled) { xRubro = txtRubro.Text; } var xDescripcion = string.Empty; if (txtDescripcion.Enabled) { xDescripcion = txtDescripcion.Text; } try { var BL = new tb_co_rubroventasBL(); var BE = new tb_co_rubroventas(); BE.rubroid = xRubro; BE.rubroname = xDescripcion; BE.cuentaid = xCuenta; PCGCURSOR = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if ((PCGCURSOR.Rows.Count > 0)) { GridExaminar.AutoGenerateColumns = false; GridExaminar.DataSource = PCGCURSOR; CargaDatos(); Ponedatos(); } else { sw_load = false; } }
public bool Update(string empresaid, tb_co_rubroventas BE) { return tablaDA.Update(empresaid, BE); }
public bool Insert(string empresaid, tb_co_rubroventas BE) { return tablaDA.Insert(empresaid, BE); }
public DataSet GetAll(string empresaid, tb_co_rubroventas BE) { return tablaDA.GetAll(empresaid, BE); }
public DataSet GetAll_IR(string empresaid, tb_co_rubroventas BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoRubroventas_SEARCH_IR", cnx)) { DataSet ds = new DataSet(); { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@perianio", SqlDbType.Char, 4).Value = BE.perianio; cmd.Parameters.Add("@rubroid", SqlDbType.Char, 4).Value = BE.rubroid; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { Sql_Error = ex.Message; throw new Exception(ex.Message); } } } }
public bool Insert(string empresaid, tb_co_rubroventas BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCoRubroventas_INSERT", cnx)) { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@rubroid", SqlDbType.Char, 4).Value = BE.rubroid; cmd.Parameters.Add("@rubroname", SqlDbType.VarChar, 100).Value = BE.rubroname; cmd.Parameters.Add("@cuentaid", SqlDbType.Char, 10).Value = BE.cuentaid; cmd.Parameters.Add("@cuentaname", SqlDbType.VarChar, 100).Value = BE.cuentaname; cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status; try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
private String UbicarRubroId(string cuentaid) { tb_co_rubroventasBL BL = new tb_co_rubroventasBL(); tb_co_rubroventas BE = new tb_co_rubroventas(); DataTable table = new DataTable(); BE.cuentaid = cuentaid; try { table = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return table.Rows[0]["rubroid"].ToString(); }