public bool Delete(string empresaid, tb_cliente BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCliente_DELETE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ctacte", SqlDbType.Char, 7).Value = BE.ctacte; cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public void ValidaDetalle() { if (txtRuc.Text.Trim().Length > 0) { clienteBL BL = new clienteBL(); tb_cliente BE = new tb_cliente(); BE.nmruc = txtRuc.Text; DataTable tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (tmptabla.Rows.Count == 0) { txtRuc.Text = j_String; } else { //txtRuc.Text = tmptabla.Rows[0]["nmruc"].ToString(); txtCtactename.Text = tmptabla.Rows[0]["ctactename"].ToString(); U_CargaDatos(); } } else { txtRuc.Text = j_String; } }
public string BuscarCrear(string empresaid, tb_cliente BE) { //return tablaDA.BuscarCrear(empresaid, BE); string zreturn = tablaDA.BuscarCrear(empresaid, BE); Sql_Error = tablaDA.Sql_Error; return zreturn; }
public DataSet GetAll(string empresaid, tb_cliente BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCliente_SEARCH", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ctacte", SqlDbType.Char, 7).Value = BE.ctacte; cmd.Parameters.Add("@ctactename", SqlDbType.VarChar, 70).Value = BE.ctactename; cmd.Parameters.Add("@docuidentid", SqlDbType.Char, 2).Value = BE.docuidentid; cmd.Parameters.Add("@nmruc", SqlDbType.Char, 11).Value = BE.nmruc; cmd.Parameters.Add("@tpperson", SqlDbType.Char, 1).Value = BE.tpperson; cmd.Parameters.Add("@agerent", SqlDbType.Bit).Value = BE.agerent; cmd.Parameters.Add("@appat", SqlDbType.VarChar, 20).Value = BE.appat; cmd.Parameters.Add("@apmat", SqlDbType.VarChar, 20).Value = BE.apmat; cmd.Parameters.Add("@nombr", SqlDbType.VarChar, 30).Value = BE.nombr; cmd.Parameters.Add("@direc", SqlDbType.VarChar, 100).Value = BE.direc; cmd.Parameters.Add("@paisid", SqlDbType.Char, 4).Value = BE.paisid; cmd.Parameters.Add("@ubige", SqlDbType.Char, 6).Value = BE.ubige; cmd.Parameters.Add("@telef1", SqlDbType.VarChar, 12).Value = BE.telef1; cmd.Parameters.Add("@email", SqlDbType.VarChar, 50).Value = BE.email; cmd.Parameters.Add("@urweb", SqlDbType.VarChar, 50).Value = BE.urweb; cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status; cmd.Parameters.Add("@telef2", SqlDbType.VarChar, 12).Value = BE.telef2; cmd.Parameters.Add("@clientetipo", SqlDbType.Char, 1).Value = BE.clientetipo; cmd.Parameters.Add("@contacto", SqlDbType.VarChar, 40).Value = BE.contacto; cmd.Parameters.Add("@vendorid", SqlDbType.Char, 4).Value = BE.vendorid; cmd.Parameters.Add("@top20", SqlDbType.Char, 1).Value = BE.filtro; cmd.Parameters.Add("@defacliepub", SqlDbType.Bit).Value = BE.defacliepub; } try { cnx.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public string BuscarCrear(string empresaid, tb_cliente BE) { string newcod = ""; using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCliente_BUSCARCREAR", cnx)) { { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; //cmd.Parameters.Add("@ctacte", SqlDbType.Char, 7).Direction = ParameterDirection.Output; cmd.Parameters.Add("@ctactename", SqlDbType.VarChar, 70).Value = BE.ctactename; cmd.Parameters.Add("@docuidentid", SqlDbType.Char, 2).Value = BE.docuidentid; cmd.Parameters.Add("@nmruc", SqlDbType.Char, 11).Value = BE.nmruc; cmd.Parameters.Add("@tpperson", SqlDbType.Char, 2).Value = BE.tpperson; cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar; } try { cnx.Open(); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { newcod = Convert.ToString(reader["ctacte"]); } return newcod; } catch (Exception ex) { Sql_Error = ex.Message; throw new Exception(ex.Message); } } } }
public void ValidaDetalle() { sw_novaluechange = true; Int16 lc_cont = default(Int16); bool zhallado = false; string xcodartic = ".."; if (txtRuc.Text.Trim().Length > 0) { xcodartic = txtRuc.Text; } if (xcodartic.Trim().Length == 0) { } else { clienteBL BL = new clienteBL(); tb_cliente BE = new tb_cliente(); BE.nmruc = xcodartic; tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; //tmptabla = ocapa.cag1000_CONSULTA(GlobalVars.GetInstance.Company, xcodartic, "", "", "", "", "", "", 1, "", 0, "", ""); if (BL.Sql_Error.Length == 0) { if (tmptabla.Rows.Count > 0) { txtRuc.Text = tmptabla.Rows[lc_cont]["nmruc"].ToString(); txtCtactename.Text = tmptabla.Rows[lc_cont]["ctactename"].ToString(); zhallado = true; } } } if (!zhallado) { txtRuc.Text = j_ruc; } else { AnexaDetalle(); } sw_novaluechange = false; txtRuc.Focus(); }
private void ValidamosProcedencia() { clienteBL BL = new clienteBL(); tb_cliente BE = new tb_cliente(); DataTable dt = new DataTable(); BE.ctacte = _ctacte.ToString(); BE.filtro = "2"; dt = BL.GetAll(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { if (modulo.ToString() != "0500") // Diferente Porque No Diferenciamos su Proveedor { String set_ctacte = dt.Rows[0]["ctacte"].ToString().Trim(); String set_ctactename = dt.Rows[0]["ctactename"].ToString().Trim(); String set_paisname = dt.Rows[0]["paisname"].ToString().Trim(); String set_paisid = dt.Rows[0]["paisid"].ToString().Trim(); if (set_paisid == "9589") // Codigo de Peru { this.procedenciaid.SelectedIndex = 0; txt_paisname.Text = set_paisname.ToString(); } else { this.procedenciaid.SelectedIndex = 1; txt_paisname.Text = set_paisname.ToString(); } } else { this.procedenciaid.SelectedIndex = 0; txt_paisname.Text = "PERÚ"; } } else { } }
private void ValidaProveedor() { if (txtRuc.Text.Trim().Length > 0) { clienteBL BL = new clienteBL(); tb_cliente BE = new tb_cliente(); BE.nmruc = txtRuc.Text; DataTable tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (tmptabla.Rows.Count == 0) { txtRuc.Text = j_String; } else { xtipopersona = tmptabla.Rows[0]["tpperson"].ToString(); xtipodocidentidad = tmptabla.Rows[0]["docuidentid"].ToString(); xctacte = tmptabla.Rows[0]["ctacte"].ToString(); txtRuc.Text = tmptabla.Rows[0]["nmruc"].ToString(); txtCtactename.Text = tmptabla.Rows[0]["ctactename"].ToString(); xdirec = tmptabla.Rows[0]["direc"].ToString(); xubige = tmptabla.Rows[0]["ubige"].ToString(); } } else { txtRuc.Text = j_String; } }
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; } }
public String GetNextCod(string empresaid, tb_cliente BE) { return tablaDA.GetNextCod(empresaid, BE); }
public bool Update(string empresaid, tb_cliente BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCliente_UPDATE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ctacte", SqlDbType.Char, 7).Value = BE.ctacte; cmd.Parameters.Add("@ctactename", SqlDbType.VarChar, 70).Value = BE.ctactename; cmd.Parameters.Add("@docuidentid", SqlDbType.Char, 1).Value = BE.docuidentid; cmd.Parameters.Add("@nmruc", SqlDbType.Char, 11).Value = BE.nmruc; cmd.Parameters.Add("@tpperson", SqlDbType.Char, 2).Value = BE.tpperson; cmd.Parameters.Add("@agerent", SqlDbType.Bit).Value = BE.agerent; cmd.Parameters.Add("@appat", SqlDbType.VarChar, 20).Value = BE.appat; cmd.Parameters.Add("@apmat", SqlDbType.VarChar, 20).Value = BE.apmat; cmd.Parameters.Add("@nombr", SqlDbType.VarChar, 30).Value = BE.nombr; cmd.Parameters.Add("@direc", SqlDbType.VarChar, 100).Value = BE.direc; cmd.Parameters.Add("@paisid", SqlDbType.Char, 4).Value = BE.paisid; cmd.Parameters.Add("@ubige", SqlDbType.Char, 6).Value = BE.ubige; cmd.Parameters.Add("@telef1", SqlDbType.VarChar, 12).Value = BE.telef1; cmd.Parameters.Add("@email", SqlDbType.VarChar, 50).Value = BE.email; cmd.Parameters.Add("@urweb", SqlDbType.VarChar, 50).Value = BE.urweb; cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status; cmd.Parameters.Add("@dscto3", SqlDbType.Decimal).Value = BE.dscto3; cmd.Parameters.Add("@telef2", SqlDbType.VarChar, 12).Value = BE.telef2; cmd.Parameters.Add("@clientetipo", SqlDbType.Char, 1).Value = BE.clientetipo; cmd.Parameters.Add("@contacto", SqlDbType.VarChar, 40).Value = BE.contacto; cmd.Parameters.Add("@vendorid", SqlDbType.Char, 4).Value = BE.vendorid; cmd.Parameters.Add("@diralter", SqlDbType.Bit).Value = BE.diralter; cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar; cmd.Parameters.Add("@nctactedetraccion", SqlDbType.Char, 15).Value = BE.nctactedetraccion; cmd.Parameters.Add("@listaprecid", SqlDbType.Int).Value = BE.listaprecid; cmd.Parameters.Add("@replegaldni", SqlDbType.Char, 8).Value = BE.replegaldni; cmd.Parameters.Add("@replegalname", SqlDbType.VarChar, 30).Value = BE.replegalname; cmd.Parameters.Add("@canalventaid", SqlDbType.Char, 3).Value = BE.canalventaid; } try { cnx.Open(); if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public String GetNextCod(string empresaid, tb_cliente BE) { String newcod = ""; using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbCliente_SEARCH_nextcod", cnx)) { cmd.CommandType = CommandType.StoredProcedure; try { cnx.Open(); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { newcod = Convert.ToString(reader["nextcod"]); } return newcod; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
private void data_gridRazonSocial() { clienteBL BL = new clienteBL(); tb_cliente BE = new tb_cliente(); switch (cbo_filtro.SelectedValue) { case "01": BE.ctacte = txt_filter.Text.Trim().ToUpper(); break; case "02": BE.ctactename = txt_filter.Text.Trim().ToUpper(); break; default: //** break; } try { //Eliminar Columnas Actuales(Opcional): GridView1.Columns.Clear(); GridView1.Width = 550; //Objeto Columna: CommandField image; //Crear Columna: image = new CommandField(); image.ButtonType = ButtonType.Image; image.SelectImageUrl = "~/Images/go-search.png"; image.ShowSelectButton = true; image.ItemStyle.Width = 10; image.ItemStyle.Wrap = true; GridView1.Columns.Add(image); BoundField DDNNI; DDNNI = new BoundField(); DDNNI.DataField = "ctacte"; DDNNI.HeaderText = "CODIGO"; DDNNI.ItemStyle.Width = 80; GridView1.Columns.Add(DDNNI); BoundField NOMBR; NOMBR = new BoundField(); NOMBR.DataField = "ctactename"; NOMBR.HeaderText = "NOMBRES"; NOMBR.ItemStyle.Width = 250; GridView1.Columns.Add(NOMBR); GridView1.DataSource = BL.GetAll(Session["ssEmpresaID"].ToString(), BE); GridView1.DataBind(); GridView1.Visible = true; } catch (Exception ex) { ClientMessage(ex.Message); } }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { try { switch (filtro) { case "PS": tb_cxc_vendorBL PSBL = new tb_cxc_vendorBL(); tb_cxc_vendor PSBE = new tb_cxc_vendor(); DataTable PSDT = new DataTable(); PSBE.ddnni = GridView1.SelectedRow.Cells[2].Text; PSDT = PSBL.GetAll(Session["ssEmpresaID"].ToString(), PSBE).Tables[0]; txt_vendorid.Text = PSDT.Rows[0]["vendorid"].ToString(); txt_vendorname.Text = PSDT.Rows[0]["vendorname"].ToString(); break; case "PR": clienteBL BL = new clienteBL(); tb_cliente BE = new tb_cliente(); DataTable dt = new DataTable(); BE.ctacte = GridView1.SelectedRow.Cells[1].Text; dt = BL.GetAll(Session["ssEmpresaID"].ToString(), BE).Tables[0]; txt_ctacte.Text = dt.Rows[0]["ctacte"].ToString(); txt_ctactename.Text = dt.Rows[0]["ctactename"].ToString(); txt_ruc.Text = dt.Rows[0]["nmruc"].ToString(); direc_entrega.Text = dt.Rows[0]["direc"].ToString(); break; case "PA": txt_articidold.Text = GridView1.SelectedRow.Cells[1].Text; MetodoCargarLineal(); break; } UpdatePanel2.Update(); ModalPopupExtender2.Hide(); } catch (Exception ex) { ClientMessage(ex.Message); } }
private void ValidaProveedorAval() { if (txtRucAval.Text.Trim().Length > 0) { clienteBL BL = new clienteBL(); tb_cliente BE = new tb_cliente(); BE.nmruc = txtRucAval.Text; DataTable tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (tmptabla.Rows.Count == 0) { txtRucAval.Text = j_String; } else { xctacteaval = tmptabla.Rows[0]["ctacte"].ToString(); txtRucAval.Text = tmptabla.Rows[0]["nmruc"].ToString().Trim(); txtCtactenameAval.Text = tmptabla.Rows[0]["ctactename"].ToString().Trim(); txtDireccionAval.Text = tmptabla.Rows[0]["direc"].ToString().Trim(); txtTelefAval.Text = tmptabla.Rows[0]["telef1"].ToString().Trim(); } } else { txtRuc.Text = j_String; } }
private void ValidaProveedor() { if (txtRuc.Text.Trim().Length > 0) { clienteBL BL = new clienteBL(); tb_cliente BE = new tb_cliente(); BE.nmruc = txtRuc.Text; DataTable tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (tmptabla.Rows.Count == 0) { xctacte = j_Ctacte; txtRuc.Text = j_String; } else { xtipopersona = tmptabla.Rows[0]["tpperson"].ToString(); xtipodocidentidad = tmptabla.Rows[0]["docuidentid"].ToString(); xctacte = tmptabla.Rows[0]["ctacte"].ToString(); txtRuc.Text = tmptabla.Rows[0]["nmruc"].ToString(); txtCtactename.Text = tmptabla.Rows[0]["ctactename"].ToString().Trim(); //txtDireccion.Text = tmptabla.Rows[0]["direc"].ToString().Trim(); xdirec = tmptabla.Rows[0]["direc"].ToString().Trim(); xubige = tmptabla.Rows[0]["ubige"].ToString().Trim(); //cboDpto.SelectedValue = Equivalencias.Left(xubige, 2); //LlenarProvi(cboProv, cboDistr, cboDpto.SelectedValue.ToString()); //LlenarDistr(cboDistr, cboProv.SelectedValue.ToString()); //cboProv.SelectedValue = Equivalencias.Left(xubige, 4); //cboDistr.SelectedValue = xubige; if (object.ReferenceEquals(tmptabla.Rows[0]["agerent"], DBNull.Value)) { rbagenteretencionsi.Checked = false; rbagenteretencionno.Checked = true; } else { rbagenteretencionsi.Checked = Convert.ToBoolean(tmptabla.Rows[0]["agerent"]) == true; rbagenteretencionno.Checked = Convert.ToBoolean(tmptabla.Rows[0]["agerent"]) == false; } if (object.ReferenceEquals(tmptabla.Rows[0]["buencontr"], DBNull.Value)) { rbbuencontribuyentesi.Checked = false; rbbuencontribuyenteno.Checked = true; } else { rbbuencontribuyentesi.Checked = Convert.ToBoolean(tmptabla.Rows[0]["buencontr"]) == true; rbbuencontribuyenteno.Checked = Convert.ToBoolean(tmptabla.Rows[0]["buencontr"]) == false; } if (object.ReferenceEquals(tmptabla.Rows[0]["buencontr"], DBNull.Value)) { rbpercepcionsi.Checked = false; rbpercepcionno.Checked = true; } else { rbpercepcionsi.Checked = Convert.ToBoolean(tmptabla.Rows[0]["agenperc"]) == true; rbpercepcionno.Checked = Convert.ToBoolean(tmptabla.Rows[0]["agenperc"]) == false; } } } else { xctacte = j_Ctacte; txtRuc.Text = j_String; } }
private bool Validacion_Grabar() { object xobjeto = null; int lc_cont = 0; string xmsgstring = ""; DataTable tmptabla = new DataTable(); dynamic xfill = "###..."; if (txtCuentaid.Text.Trim().Length == 0) { xmsgstring = (xmsgstring + ("\r\n" + "Configure Cuenta para retención del IGV !!!")); xobjeto = txtCuentaid; } //if (txtCuentaidP.Text.Trim().Length == 0) //{ // if (rbnPagos.Checked == true | rbnLetras.Checked == true) // { // xmsgstring = (xmsgstring + ("\r\n" + "Configure Cuenta para el pago o canje en letras !!!")); // xobjeto = txtCuentaidP; // } //} if (txtRuc.Text.Trim().Length == 0) { xmsgstring = (xmsgstring + ("\r\n" + "Ingrese Proveedor !!!")); xobjeto = txtRuc; } else { try { clienteBL BL = new clienteBL(); tb_cliente BE = new tb_cliente(); BE.nmruc = txtRuc.Text.Trim(); tmptabla = BL.GetAll(VariablesPublicas.EmpresaID, BE).Tables[0]; if ((BL.Sql_Error.Length > 0)) { Frm_Class.ShowError(("Error al validar datos de proveedor" + ("\r\n" + BL.Sql_Error)), this); return false; } if ((tmptabla.Rows.Count == 0)) { xmsgstring = (xmsgstring + ("\r\n" + "Proveedor no existe")); xobjeto = txtRuc; } //if ((BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]).Rows.Count == 0) //{ // xmsgstring = (xmsgstring + ('\r' + "Proveedor no existe !!!")); // xobjeto = txtRuc; //} else { if ((!object.ReferenceEquals(tmptabla.Rows[0]["agerent"], DBNull.Value))) { if (Convert.ToBoolean(tmptabla.Rows[0]["agerent"])) { xmsgstring = (xmsgstring + ("\r\n" + "No se puede aplicar retención sobre un Agente de Retención")); xobjeto = txtRuc; } } if ((!object.ReferenceEquals(tmptabla.Rows[0]["buencontr"], DBNull.Value))) { if (Convert.ToBoolean(tmptabla.Rows[0]["buencontr"])) { xmsgstring = (xmsgstring + ("\r\n" + "No se puede aplicar retención sobre un buen contribuyente")); xobjeto = txtRuc; } } if ((!object.ReferenceEquals(tmptabla.Rows[0]["agenperc"], DBNull.Value))) { if (Convert.ToBoolean(tmptabla.Rows[0]["agenperc"])) { xmsgstring = (xmsgstring + ("\r\n" + "No se puede aplicar retención sobre un Agente de Percepción")); xobjeto = txtRuc; } } } } catch (Exception ex) { DevExpress.XtraEditors.XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } decimal vmncambio = VariablesPublicas.StringtoDecimal(txtTipocambio.Text); if (vmncambio == 0) { xmsgstring = (xmsgstring + ("\r\n" + "Ingrese Tipo de Cambio !!!")); xobjeto = fRegistro; } if ((txtGlosa.Text.Trim()).Trim().Length == 0) { xmsgstring = (xmsgstring + ("\r\n" + "Ingrese glosa !!!")); xobjeto = txtGlosa; } //if ((txtNumOpe.Text.Trim()).Trim().Length == 0) //{ // xmsgstring = (xmsgstring + ("\r\n" + "Ingrese Número Cheque u Operación !!!")); // xobjeto = txtNumOpe; //} decimal montoretencion = VariablesPublicas.StringtoDecimal(txtImpRetencion.Text); if (montoretencion == 0) { xmsgstring = (xmsgstring + ("\r\n" + "Click en Botón Cálcular Retención !!!")); xobjeto = btnCalcular; } if ((xmsgstring.Trim().Length == 0)) { for (lc_cont = 0; (lc_cont <= (DetFacturacion.Rows.Count - 1)); lc_cont++) { if (((Convert.ToDecimal(DetFacturacion.Rows[lc_cont]["importeretencionsoles"]) == 0))) //&& (Convert.ToDecimal(DetFacturacion.Rows[lc_cont]["impretencion1"]) == 0))) { xmsgstring = (xmsgstring + ("\r\n" + "Ingrese Retención del documento")); } if (((DetFacturacion.Rows[lc_cont]["tipdoc"].ToString().Trim().Length > 0) && (DetFacturacion.Rows[lc_cont]["numdoc"].ToString().Trim().Length > 0))) { tb_co_ComprascabBL BLCO = new tb_co_ComprascabBL(); tb_co_Comprascab BECO = new tb_co_Comprascab(); BECO.nmruc = txtRuc.Text.Trim(); BECO.tipodoc = DetFacturacion.Rows[lc_cont]["tipdoc"].ToString(); BECO.serdoc = DetFacturacion.Rows[lc_cont]["serdoc"].ToString(); BECO.numdoc = DetFacturacion.Rows[lc_cont]["numdoc"].ToString(); tmptabla = BLCO.GetAll(VariablesPublicas.EmpresaID.ToString(), BECO).Tables[0]; //tmptabla = ocapa.KAG0300_consulta(GlobalVars.GetInstance.Company, "", "", "", "", "", TXTCODCLIENTE.Text, DetFacturacion.Rows[lc_cont]["tipdoc_3a"], DetFacturacion.Rows[lc_cont]["numdoc"].Substring(0, 4), DetFacturacion.Rows[lc_cont]["numdoc"].Substring(5, 8)); if ((BLCO.Sql_Error.Length > 0)) { Frm_Class.ShowError(("Error al validar documento de Compra " + ("\r\n" + BLCO.Sql_Error)), this); return false; } if ((tmptabla.Rows.Count > 0)) { if ((Convert.ToBoolean(tmptabla.Rows[0]["afecdetraccion"]) == true)) { xmsgstring = (xmsgstring + "\r\n" + "Asiento R/C N°: " + tmptabla.Rows[0]["diarioid"].ToString() + "/" + tmptabla.Rows[0]["perimes"].ToString() + "-" + tmptabla.Rows[0]["asiento"].ToString() + "\r\n" + "Comprobante N°: " + DetFacturacion.Rows[lc_cont]["tipdoc"].ToString() + "/" + DetFacturacion.Rows[lc_cont]["serdoc"].ToString() + "-" + DetFacturacion.Rows[lc_cont]["numdoc"].ToString() + "\r\n" + "Tiene Detracción ... Imposible Aplicar Retención"); } } } } } if (xmsgstring.Trim().Length == 0) { //if (u_n_opsel == 1 | (W_KEY0001 != cboTipdoc.SelectedValue.ToString().Trim() + txtSerie.Text.Trim() + txtNumero.Text.Trim())) //{ // tmptabla = null; // try // { // tb_co_retencionescabBL BL = new tb_co_retencionescabBL(); // tb_co_retencionescab BE = new tb_co_retencionescab(); // //BE.nmruc = txtRuc.Text; // BE.tipdoc = cboTipdoc.SelectedValue.ToString().Trim(); // BE.serdoc = txtSerie.Text.Trim(); // BE.numdoc = txtNumero.Text.Trim(); // 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]["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; } }
public bool Update2(string empresaid, tb_cliente BE) { return tablaDA.Update2(empresaid, BE); }
public bool Insert(string empresaid, tb_cliente BE) { return tablaDA.Insert(empresaid, BE); }
private void ValidaCliente() { if (dominioid.Text.Trim().Length > 0) { clienteBL BL = new clienteBL(); tb_cliente BE = new tb_cliente(); DataTable dt = new DataTable(); String cta = ctacte.Text.Trim().PadLeft(7, '0'); BE.ctacte = cta.ToString(); ctacte.Text = cta.ToString(); dt = BL.GetAll(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { ctacte.Text = dt.Rows[0]["ctacte"].ToString().Trim(); xNmruc = dt.Rows[0]["nmruc"].ToString().Trim(); xLocalDirec = dt.Rows[0]["localdirec"].ToString().Trim(); ctactename.Text = dt.Rows[0]["ctactename"].ToString().Trim(); direcnume.Text = dt.Rows[0]["direcnume"].ToString().Trim(); } else { ctacte.Text = ""; xNmruc = ""; xLocalDirec = ""; ctactename.Text = ""; direcnume.Text = ""; } } else { ctacte.Text = ""; xNmruc = ""; xLocalDirec = ""; ctactename.Text = ""; direcnume.Text = ""; } }
public DataSet GetAll_CODdbf(string empresaid, tb_cliente BE) { Conex_FoxDA cone = new Conex_FoxDA(); using (OleDbConnection cnx = new OleDbConnection(cone.AdmConexion())) { String commandString = "SELECT COUNT(*) cant FROM faccl600 WHERE CL600IDCL = ?"; using (OleDbCommand cmd = new OleDbCommand(commandString, cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = System.Data.CommandType.Text; cmd.Parameters.Add("@CL600IDCL ", OleDbType.Char, 4).Value = BE.ctacte; } try { cnx.Open(); using (OleDbDataAdapter da = new OleDbDataAdapter(cmd)) { da.Fill(ds); } return ds; } catch (Exception ex) { throw new Exception(ex.Message); } } } }
public bool Delete(string empresaid, tb_cliente BE) { return tablaDA.Delete(empresaid, BE); }
private void ValidaCliente() { if (nmruc.Text.Trim().Length > 0 || ctacte.Text.Trim().Length > 0) { var BL = new clienteBL(); var BE = new tb_cliente(); var dt = new DataTable(); BE.ctacte = ctacte.Text.Trim().PadLeft(7, '0'); if (nmruc.Text.Trim().Length > 0) { BE.nmruc = nmruc.Text.Trim(); } dt = BL.GetAll(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { ctacte.Text = dt.Rows[0]["ctacte"].ToString().Trim(); nmruc.Text = dt.Rows[0]["nmruc"].ToString().Trim(); ctactename.Text = dt.Rows[0]["ctactename"].ToString().Trim(); direc.Text = dt.Rows[0]["direc"].ToString().Trim(); } else { ctacte.Text = string.Empty; nmruc.Text = string.Empty; ctactename.Text = string.Empty; direc.Text = string.Empty; direcnume = string.Empty; direcname.Text = string.Empty; direcdeta.Text = string.Empty; nmruc.Focus(); } } }
private void ValidamosProcedencia() { var BL = new clienteBL(); var BE = new tb_cliente(); var dt = new DataTable(); BE.ctacte = _ctacte.ToString(); BE.filtro = "2"; dt = BL.GetAll(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { if (moduloiddes.SelectedValue.ToString() != "0500") { dt.Rows[0]["ctacte"].ToString().Trim(); dt.Rows[0]["ctactename"].ToString().Trim(); var set_paisname = dt.Rows[0]["paisname"].ToString().Trim(); var set_paisid = dt.Rows[0]["paisid"].ToString().Trim(); if (set_paisid == "9589") { procedenciaid.SelectedIndex = 0; txt_paisname.Text = set_paisname.ToString(); } else { procedenciaid.SelectedIndex = 1; txt_paisname.Text = set_paisname.ToString(); } } else { procedenciaid.SelectedIndex = 0; txt_paisname.Text = "PERÚ"; } } }
public bool Update_dbf(string empresaid, tb_cliente BE) { Conex_Fox2DA cone = new Conex_Fox2DA(); using (OleDbConnection cnx = new OleDbConnection(cone.AdmConexion())) { String commandString = "UPDATE faccl600 SET " + " CL600STAT = ? ,"+ " CL600NAME = ? ,"+ " CL600NRUC = ? ," + " CL600TABL = ? ," + " CL600TPCL = ? ," + " CL600SERV = ? ," + " CL600APCP = ? ," + " CL600CALM = ? ," + " CL600CATE = ? ," + " CL600REPR = ? ," + " CL600DOID = ? ," + " CL600USID = ? ," + " CL600FEAC = ? ," + " CL600IDSC = ? ," + " CL600TAPI = ? ," + " CL600DIRE = ? ," + " CTACTE = ? " + " WHERE CL600IDCL = ? "; OleDbCommand cmd = new OleDbCommand(commandString, cnx); cmd.Parameters.Add("@CL600STAT", OleDbType.Integer).Value = BE.status; cmd.Parameters.Add("@CL600NAME", OleDbType.VarChar, 60).Value = BE.ctactename; cmd.Parameters.Add("@CL600NRUC", OleDbType.VarChar, 11).Value = BE.nmruc; cmd.Parameters.Add("@CL600TABL", OleDbType.Integer).Value = "0".ToString(); cmd.Parameters.Add("@CL600TPCL", OleDbType.Char, 1).Value = "P".ToString(); cmd.Parameters.Add("@CL600SERV", OleDbType.VarChar, 30).Value = "03".ToString(); cmd.Parameters.Add("@CL600APCP", OleDbType.Char, 2).Value = "05".ToString(); cmd.Parameters.Add("@CL600CALM", OleDbType.Char, 2).Value = "".ToString(); cmd.Parameters.Add("@CL600CATE", OleDbType.Char, 1).Value = "M".ToString(); cmd.Parameters.Add("@CL600REPR", OleDbType.VarChar, 25).Value = BE.replegalname; cmd.Parameters.Add("@CL600DOID", OleDbType.VarChar, 8).Value = BE.replegaldni; cmd.Parameters.Add("@CL600USID", OleDbType.Char, 3).Value = BE.usuar; cmd.Parameters.Add("@CL600FEAC", OleDbType.Date).Value = DateTime.Today.ToShortDateString(); cmd.Parameters.Add("@CL600IDSC", OleDbType.Char, 2).Value = "".ToString(); cmd.Parameters.Add("@CL600TAPI", OleDbType.Boolean).Value = false; cmd.Parameters.Add("@CL600DIRE", OleDbType.VarChar, 100).Value = BE.direc; cmd.Parameters.Add("@CTACTE", OleDbType.VarChar, 7).Value = BE.ctacte; cmd.Parameters.Add("@CL600IDCL", OleDbType.Char, 4).Value = BE.ctacte; cnx.Open(); try { if (cmd.ExecuteNonQuery() > 0) { return true; } else { return false; } } catch (Exception ex) { throw new Exception(ex.Message); } } }
public DataSet GetAll_direc(string empresaid, tb_cliente BE) { return tablaDA.GetAll_direc(empresaid, BE); }
public void ValidaDetalle() { sw_novaluechange = true; Int16 lc_cont = default(Int16); bool zhallado = false; string xcodartic = ".."; if (txtRuc.Text.Trim().Length > 0) { xcodartic = txtRuc.Text; } if (xcodartic.Trim().Length == 0) { txtCtactename.Text = ""; zhallado = true; } else { clienteBL BL = new clienteBL(); tb_cliente BE = new tb_cliente(); BE.nmruc = xcodartic; tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (tmptabla.Rows.Count > 0) { xctacte = tmptabla.Rows[lc_cont]["ctacte"].ToString(); txtRuc.Text = tmptabla.Rows[lc_cont]["nmruc"].ToString(); txtCtactename.Text = tmptabla.Rows[lc_cont]["ctactename"].ToString().Trim(); zhallado = true; } } if (!zhallado) { txtRuc.Text = j_ruc; } sw_novaluechange = false; }
public void ValidaDetalle() { if (txtdetalle.Text.Trim().Length > 0) { var BL = new clienteBL(); var BE = new tb_cliente(); BE.nmruc = txtdetalle.Text.Trim(); tmptabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (BL.Sql_Error.Length == 0) { if (tmptabla.Rows.Count > 0) { txtdcuentamayor.Text = tmptabla.Rows[0]["ctactename"].ToString(); U_CargaDatos(); } } } }
private void ValidaCliente() { if (txt_ctacte.Text.Trim().Length > 0) { var BL = new clienteBL(); var BE = new tb_cliente(); var dt = new DataTable(); BE.ctacte = txt_ctacte.Text.Trim().PadLeft(7, '0'); dt = BL.GetAll(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { txt_ctacte.Text = dt.Rows[0]["ctacte"].ToString().Trim(); txt_ctactename.Text = dt.Rows[0]["ctactename"].ToString().Trim(); } else { txt_ctacte.Text = string.Empty; txt_ctactename.Text = string.Empty; } } }
private void ValidaProveedor() { DataTable tmtabla = null; string xcodmotivo = ".."; if (txtRuc.Text.Trim().Length > 0) { xcodmotivo = txtRuc.Text.Trim(); } clienteBL BL = new clienteBL(); tb_cliente BE = new tb_cliente(); BE.nmruc = xcodmotivo; tmtabla = BL.GetAll(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0]; if (tmtabla.Rows.Count == 0) { txtRuc.Text = j_String; } else { txtCtacte.Text = tmtabla.Rows[0]["ctacte"].ToString().Trim(); txtRuc.Text = tmtabla.Rows[0]["nmruc"].ToString(); lblnomprov.Text = tmtabla.Rows[0]["ctactename"].ToString(); } }