private void btnSocioNegocio_Click(object sender, EventArgs e) { double d; int u; if (numeroFilasActual() == 0) { _frmBusqueda ventana = new _frmBusqueda(false, "buscarProveedor", _obalSOCIO); DialogResult respuesta = ventana.ShowDialog(); if (respuesta == DialogResult.OK) { eSOCIO _oeSOCIO = new eSOCIO(); _oeSOCIO.SOC_codigo = Int32.TryParse(ventana.pk.Trim(), out u) ? Convert.ToInt32(ventana.pk.Trim()) : -1; DataTable dt = balSOCIO.obtenerRegistro(_oeSOCIO); if (dt != null) { this.txtCodigoSocio.Text = dt.Rows[0]["SOC_codigo"].ToString(); this.txtNombreSocio.Text = dt.Rows[0]["SOC_nombre_razon_social"].ToString(); } else { MessageBox.Show("Seleccione un socio de negocio válido.", "SICO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } else { MessageBox.Show("No es posible cambiar el socio de negocio cuando ya se han ingresado productos.", "SICO", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public override void Siguiente() { int u; eSOCIO o = new eSOCIO(); o.SOC_codigo = Int32.TryParse(this.txtCodigo.Text.Trim(), out u) ? Convert.ToInt32(this.txtCodigo.Text.Trim()) : -1; cargarDatos(balSOCIO.siguienteRegistro(o)); }
public override bool Eliminar() { int i; bool rpta = false; try { eSOCIO o = new eSOCIO(); o.SOC_codigo = Int32.TryParse(this.txtCodigo.Text.Trim(), out i) ? Convert.ToInt32(this.txtCodigo.Text.Trim()) : -1; if (balSOCIO.eliminarRegistro(o)) { mensaje("eliminar", ""); //MessageBox.Show("El registro fue eliminado correctamente.", "SICO", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtCodigo.ReadOnly = true; rpta = true; } } catch (CustomException ex) { if (ex.tupla != null) { foreach (Control c in this.gpbInformacion.Controls) { foreach (var item in ex.tupla) { if (c.Tag != null && c.Tag.ToString() == item.name) { errValidacion.SetError(c, item.message.ToString()); } } foreach (Control x in c.Controls) { foreach (var item in ex.tupla) { if (x.Tag != null && x.Tag.ToString() == item.name) { errValidacion.SetError(x, item.message.ToString()); } } } } mensaje("subsanar", ""); } else { mensaje("corregir", ex.Message); } } catch (Exception ex) { MessageBox.Show("Ocurrió un error inesperado:\r\n" + ex.Message, "SICO", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(rpta); }
private void btnGoSocio_Click(object sender, EventArgs e) { int u; eSOCIO o = new eSOCIO(); o.SOC_codigo = Int32.TryParse(this.txtCodigoSocio.Text.Trim(), out u) ? Convert.ToInt32(this.txtCodigoSocio.Text.Trim()) : -1; frmDM_Socio o2 = new frmDM_Socio(o); o2.MdiParent = this.MdiParent; o2.Show(); }
private DataTable obtenerDatosProducto(int codigoSocio, string codigoProducto) { eSOCIO oeSOCIO = new eSOCIO(); oeSOCIO.SOC_codigo = Convert.ToInt16(this.txtCodigoSocio.Text); ePRODUCTO oePRODUCTO = new ePRODUCTO(); oePRODUCTO.PRO_codigo = codigoProducto; return(balPRODUCTO.obtenerRegistroComplejo(oePRODUCTO, oeSOCIO)); }
public bool actualizarRegistro(eSOCIO oeSOCIO) { using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["CadenaPrincipal"].ToString())) { string sp = "pa_crud_SOCIO_actualizarRegistro"; SqlCommand cmd = new SqlCommand(sp, cnn); cmd.CommandType = CommandType.StoredProcedure; cnn.Open(); cmd.Parameters.Add(new SqlParameter("@SOC_CODIGO", oeSOCIO.SOC_codigo)); //variable tipo:int cmd.Parameters.Add(new SqlParameter("@SOC_TIPO_SOCIO", oeSOCIO.SOC_tipo_socio)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_NOMBRE_RAZON_SOCIAL", (object)oeSOCIO.SOC_nombre_razon_social ?? DBNull.Value)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_APELLIDO_PATERNO", (object)oeSOCIO.SOC_apellido_paterno ?? DBNull.Value)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_APELLIDO_MATERNO", (object)oeSOCIO.SOC_apellido_materno ?? DBNull.Value)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_NOMBRES", (object)oeSOCIO.SOC_nombres ?? DBNull.Value)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_NUMERO_DOCUMENTO", oeSOCIO.SOC_numero_documento)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_DIRECCION", oeSOCIO.SOC_direccion)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_REFERENCIA_DIRECCION", (object)oeSOCIO.SOC_referencia_direccion ?? DBNull.Value)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_TELEFONO_FIJO", (object)oeSOCIO.SOC_telefono_fijo ?? DBNull.Value)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_TELEFONO_MOVIL", (object)oeSOCIO.SOC_telefono_movil ?? DBNull.Value)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_EMAIL", (object)oeSOCIO.SOC_email ?? DBNull.Value)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_WEB", (object)oeSOCIO.SOC_web ?? DBNull.Value)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_IS_AGENTE_RETENCION", oeSOCIO.SOC_is_agente_retencion)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_IS_AGENTE_PERCEPCION", oeSOCIO.SOC_is_agente_percepcion)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_PORCENTAJE_PERCEPCION", (object)oeSOCIO.SOC_porcentaje_percepcion ?? DBNull.Value)); //variable tipo:double cmd.Parameters.Add(new SqlParameter("@SOC_IS_VALIDAR_BONIFICACION", oeSOCIO.SOC_is_validar_bonificacion)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_IS_BONIFICACION_PERSONALIZADA", oeSOCIO.SOC_is_bonificacion_personalizada)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_IS_DESCUENTO_PERSONALIZADO", oeSOCIO.SOC_is_descuento_personalizado)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_IS_KEY_ACCOUNT", oeSOCIO.SOC_is_key_account)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_DIAS_CREDITO", oeSOCIO.SOC_dias_credito)); //variable tipo:int cmd.Parameters.Add(new SqlParameter("@SOC_FECHA_REGISTRO", oeSOCIO.SOC_fecha_registro)); //variable tipo:DateTime cmd.Parameters.Add(new SqlParameter("@SOC_LINEA_CREDITO", oeSOCIO.SOC_linea_credito)); //variable tipo:double cmd.Parameters.Add(new SqlParameter("@SOC_TIPO_PERSONA", oeSOCIO.SOC_tipo_persona)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_IS_ACTIVO", oeSOCIO.SOC_is_activo)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_COMENTARIO", (object)oeSOCIO.SOC_comentario ?? DBNull.Value)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_TIPO_DOCUMENTO_IDENTIDAD", oeSOCIO.SOC_tipo_documento_identidad)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@SOC_LATITUD", (object)oeSOCIO.SOC_latitud ?? DBNull.Value)); //variable tipo:double cmd.Parameters.Add(new SqlParameter("@SOC_LONGITUD", (object)oeSOCIO.SOC_longitud ?? DBNull.Value)); //variable tipo:double cmd.Parameters.Add(new SqlParameter("@LPR_CODIGO", oeSOCIO.LPR_codigo)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@TNE_CODIGO", oeSOCIO.TNE_codigo)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@CAN_CODIGO", oeSOCIO.CAN_codigo)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@UBI_ID", oeSOCIO.UBI_id)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@ZON_CODIGO", oeSOCIO.ZON_codigo)); //variable tipo:int cmd.Parameters.Add(new SqlParameter("@VEN_CODIGO", (object)oeSOCIO.VEN_codigo ?? DBNull.Value)); //variable tipo:int cmd.Parameters.Add(new SqlParameter("@TDO_CODIGO", (object)oeSOCIO.TDO_codigo ?? DBNull.Value)); //variable tipo:string cmd.Parameters.Add(new SqlParameter("@CPA_CODIGO", (object)oeSOCIO.CPA_codigo ?? DBNull.Value)); //variable tipo:string return(cmd.ExecuteNonQuery() > 0); } }
public bool eliminarRegistro(eSOCIO oeSOCIO) { using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["CadenaPrincipal"].ToString())) { string sp = "pa_crud_SOCIO_eliminarRegistro"; SqlCommand cmd = new SqlCommand(sp, cnn); cmd.CommandType = CommandType.StoredProcedure; cnn.Open(); cmd.Parameters.Add(new SqlParameter("@SOC_CODIGO", oeSOCIO.SOC_codigo)); return(cmd.ExecuteNonQuery() > 0); } }
public override void Buscar() { int u; eSOCIO o = new eSOCIO(); balSOCIO b = new balSOCIO(); _frmBusqueda ventana = new _frmBusqueda(false, "buscarRegistro", b); DialogResult respuesta = ventana.ShowDialog(); if (respuesta == DialogResult.OK) { o.SOC_codigo = Int32.TryParse(ventana.pk, out u) ? Convert.ToInt32(ventana.pk) : -1; DataTable dt = balSOCIO.obtenerRegistro(o); cargarDatos(dt); } }
public DataTable siguienteRegistro(eSOCIO oeSOCIO) { using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["CadenaPrincipal"].ToString())) { string sp = "pa_list_SOCIO_siguienteRegistro"; SqlCommand cmd = new SqlCommand(sp, cnn); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter dad = new SqlDataAdapter(cmd); dad.SelectCommand.Parameters.Add(new SqlParameter("@SOC_CODIGO", oeSOCIO.SOC_codigo)); DataTable dt = new DataTable(); dad.Fill(dt); return(dt); } }
public DataTable obtenerRegistroComplejo(ePRODUCTO oePRODUCTO, eSOCIO oeSOCIO) { using (SqlConnection cnn = new SqlConnection(ConfigurationManager.ConnectionStrings["CadenaPrincipal"].ToString())) { string sp = "[pa_bf_PRODUCTO_informacionDirigida]"; SqlCommand cmd = new SqlCommand(sp, cnn); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter dad = new SqlDataAdapter(cmd); dad.SelectCommand.Parameters.Add(new SqlParameter("@PRO_CODIGO", oePRODUCTO.PRO_codigo)); dad.SelectCommand.Parameters.Add(new SqlParameter("@SOC_CODIGO", oeSOCIO.SOC_codigo)); DataTable dt = new DataTable(); dad.Fill(dt); return(dt); } }
private void btnSocio_Click(object sender, EventArgs e) { _frmBusqueda ventana = new _frmBusqueda(false, "buscarRegistro", _obalSOCIO); DialogResult respuesta = ventana.ShowDialog(); if (respuesta == DialogResult.OK) { if (_oeSOCIO == null) { _oeSOCIO = new eSOCIO(); } _oeSOCIO.SOC_codigo = Convert.ToInt32(ventana.pk); DataTable dt = balSOCIO.obtenerRegistro(_oeSOCIO); if (dt != null) { this.txtCodigoSocio.Text = dt.Rows[0]["SOC_codigo"].ToString(); this.txtNombreSocio.Text = dt.Rows[0]["SOC_nombre_razon_social"].ToString(); this.dgvDescuentoSocio.DataSource = balPRODUCTO.poblarParaDescuentos(); } } }
public frmDM_Socio(eSOCIO o) { InitializeComponent(); tabla = "SOCIO"; this.cmbListaPrecio.ValueMember = "LPR_codigo"; this.cmbListaPrecio.DisplayMember = "LPR_nombre"; this.cmbListaPrecio.DataSource = balLISTA_PRECIO.poblar(); this.cmbTipoNegocio.ValueMember = "TNE_codigo"; this.cmbTipoNegocio.DisplayMember = "TNE_nombre"; this.cmbTipoNegocio.DataSource = balTIPO_NEGOCIO.poblar(); this.cmbCanal.ValueMember = "CAN_codigo"; this.cmbCanal.DisplayMember = "CAN_nombre"; this.cmbCanal.DataSource = balCANAL.poblar(); this.cmbUbigeo.ValueMember = "UBI_id"; this.cmbUbigeo.DisplayMember = "UBI_distrito"; this.cmbUbigeo.DataSource = balUBIGEO.poblar(); this.cmbZona.ValueMember = "ZON_codigo"; this.cmbZona.DisplayMember = "ZON_nombre"; this.cmbZona.DataSource = balZONA.poblar(); this.cmbTipoDocumentoVenta.ValueMember = "TDO_codigo"; this.cmbTipoDocumentoVenta.DisplayMember = "TDO_nombre"; this.cmbTipoDocumentoVenta.DataSource = balTIPO_DOCUMENTO.poblar(); this.cmbCondicionPago.ValueMember = "CPA_codigo"; this.cmbCondicionPago.DisplayMember = "CPA_descripcion"; this.cmbCondicionPago.DataSource = balCONDICION_PAGO.poblar(); this.cmbVendedor.ValueMember = "VEN_codigo"; this.cmbVendedor.DisplayMember = "VEN_nombre_completo"; this.cmbVendedor.DataSource = balVENDEDOR.poblar(); this._o = o; }
private void validarCabecera() { try { dtCab.Columns.Clear(); dtCab.Columns.Add(); dtCab.Clear(); int n = 0; DateTime d; double u; bool resultadoFila = false; bool resultadoRegistroExiste = false; int contadorErrores = 0; for (int i = 0; i < this.dgvCabecera.RowCount; i++) { resultadoFila = true; resultadoFila &= int.TryParse(this.dgvCabecera["PED_numero1", i].Value.ToString(), out n); resultadoFila &= DateTime.TryParse(this.dgvCabecera["PED_fecha", i].Value.ToString(), out d); resultadoFila &= DateTime.TryParse(this.dgvCabecera["PED_fecha_entrega", i].Value.ToString(), out d); resultadoFila &= int.TryParse(this.dgvCabecera["VEN_codigo", i].Value.ToString(), out n); resultadoFila &= this.dgvCabecera["PED_nombre_vendedor", i].Value.ToString().Length > 0; resultadoFila &= int.TryParse(this.dgvCabecera["SOC_codigo", i].Value.ToString(), out n); resultadoFila &= this.dgvCabecera["PED_soc_nombre_razon", i].Value.ToString().Length > 0; resultadoFila &= this.dgvCabecera["PED_soc_direccion", i].Value.ToString().Length > 0; resultadoFila &= int.TryParse(this.dgvCabecera["PED_soc_zona", i].Value.ToString(), out n); resultadoFila &= double.TryParse(this.dgvCabecera["PED_subtotal", i].Value.ToString(), out u); resultadoFila &= double.TryParse(this.dgvCabecera["PED_porcentaje_igv", i].Value.ToString(), out u); //resultadoFila &= double.TryParse(this.dgvCabecera["PED_porcentaje_isc", i].Value.ToString(), out u); resultadoFila &= double.TryParse(this.dgvCabecera["PED_porcentaje_percepcion", i].Value.ToString(), out u); resultadoFila &= double.TryParse(this.dgvCabecera["PED_monto_igv", i].Value.ToString(), out u); resultadoFila &= double.TryParse(this.dgvCabecera["PED_monto_isc", i].Value.ToString(), out u); resultadoFila &= double.TryParse(this.dgvCabecera["PED_monto_percepcion", i].Value.ToString(), out u); resultadoFila &= double.TryParse(this.dgvCabecera["PED_monto_total", i].Value.ToString(), out u); //resultadoFila &= int.TryParse(this.dgvCabecera["PED_comentario", i].Value.ToString(), out n); resultadoFila &= this.dgvCabecera["PED_estado", i].Value.ToString().Length == 1 && (this.dgvCabecera["PED_estado", i].Value.ToString() == "A"); resultadoFila &= this.dgvCabecera["CPA_codigo", i].Value.ToString().Length > 0; resultadoFila &= this.dgvCabecera["PED_tdo_codigo", i].Value.ToString().Length == 3; resultadoRegistroExiste = false; if (resultadoFila) { int PED_numero = Convert.ToInt16(this.dgvCabecera["PED_numero1", i].Value.ToString()); bool bandera = false; for (int t = 0; t < dtDet.Rows.Count; t++) { if (dtDet.Rows[t][0].ToString() == PED_numero.ToString()) { bandera |= true; break; } } resultadoRegistroExiste = true; ePEDIDO oePEDIDO = new ePEDIDO(); //balPEDIDO obalPEDIDO = new balPEDIDO(); eVENDEDOR oeVENDEDOR = new eVENDEDOR(); //balVENDEDOR obalVENDEDOR = new balVENDEDOR(); eSOCIO oeSOCIO = new eSOCIO(); //balSOCIO obalSOCIO = new balSOCIO(); eCONDICION_PAGO oeCONDICIONPAGO = new eCONDICION_PAGO(); //balCONDICION_PAGO obalCONDICIONPAGO = new balCONDICION_PAGO(); oePEDIDO.PED_numero = Convert.ToInt32(this.dgvCabecera["PED_numero1", i].Value.ToString()); oeVENDEDOR.VEN_codigo = Convert.ToInt16(this.dgvCabecera["VEN_codigo", i].Value.ToString()); oeSOCIO.SOC_codigo = Convert.ToInt16(this.dgvCabecera["SOC_codigo", i].Value.ToString()); oeCONDICIONPAGO.CPA_codigo = this.dgvCabecera["CPA_codigo", i].Value.ToString(); resultadoRegistroExiste &= balPEDIDO.obtenerRegistro(oePEDIDO) == null; resultadoRegistroExiste &= balVENDEDOR.obtenerRegistro(oeVENDEDOR) != null; resultadoRegistroExiste &= balSOCIO.obtenerRegistro(oeSOCIO) != null; resultadoRegistroExiste &= balCONDICION_PAGO.obtenerRegistro(oeCONDICIONPAGO) != null; resultadoRegistroExiste &= bandera; } if (resultadoRegistroExiste) { this.dgvCabecera["Check1", i].Style.BackColor = Color.LightGreen; this.dgvCabecera["Check1", i].Value = "OK"; //Carga los PED_numero al datatable dtCab DataRow dr = dtCab.NewRow(); dr[0] = this.dgvCabecera["PED_numero1", i].Value.ToString(); dtCab.Rows.Add(dr[0]); } else { this.dgvCabecera["Check1", i].Style.BackColor = Color.Orange; this.dgvCabecera["Check1", i].Value = "Err"; } if (this.dgvCabecera["Check1", i].Value.ToString() == "Err") { contadorErrores++; } } this.txtCabeceraErrores.Text = contadorErrores.ToString(); } catch (SystemException ex) { } finally { this.Cursor = Cursors.Arrow; mostrarImagenEstado(); } }
private void blanquearFilaBonificacion() { foreach (DataGridViewRow fila in this.dgvDetalle.Rows) { if (!fila.IsNewRow) { if (this.dgvDetalle["DCO_is_bonificacion", fila.Index].Value.ToString() == "SI") { this.dgvDetalle["DCO_precio_unitario", fila.Index].Value = 0; this.dgvDetalle["DCO_porcentaje_descuento", fila.Index].Value = 0; this.dgvDetalle["Subtotal", fila.Index].Value = 0; this.dgvDetalle["Impuestos", fila.Index].Value = ""; this.dgvDetalle["MontoIGV", fila.Index].Value = 0; this.dgvDetalle["MontoISC", fila.Index].Value = 0; this.dgvDetalle["DCO_monto_descuento", fila.Index].Value = 0; this.dgvDetalle["isValido", fila.Index].Value = "S"; } else { //REEMPLAZAR DataTable dt = new DataTable(); ePRODUCTO oePRODUCTO = new ePRODUCTO(); oePRODUCTO.PRO_codigo = this.dgvDetalle["PRO_codigo", fila.Index].Value.ToString(); eSOCIO oeSOCIO = new eSOCIO(); oeSOCIO.SOC_codigo = Convert.ToInt32(this.txtCodigoSocio.Text); dt = balPRODUCTO.obtenerRegistroComplejo(oePRODUCTO, oeSOCIO); string impuestos = ""; if (dt.Rows.Count > 0) { impuestos = (Convert.ToDouble(dt.Rows[0]["PorcentajeIGV"].ToString()) > 0) ? "IGV[" + dt.Rows[0]["PorcentajeIGV"].ToString() + "] " : ""; impuestos += (Convert.ToDouble(dt.Rows[0]["PRO_porcentaje_isc"].ToString()) > 0) ? "ISC[" + dt.Rows[0]["PRO_porcentaje_isc"].ToString() + "] " : ""; this.dgvDetalle["PRO_descripcion", fila.Index].Value = dt.Rows[0]["PRO_descripcion"].ToString(); //this.dgvDetalle["DCO_precio_unitario", fila.Index].Value = dt.Rows[0]["DLP_precio"].ToString(); this.dgvDetalle["Impuestos", fila.Index].Value = impuestos; this.dgvDetalle["DCO_is_bonificacion", fila.Index].Value = "NO"; //this.dgvDetalle["PRO_is_IGV", fila.Index].Value = dt.Rows[0]["PRO_is_IGV"].ToString(); this.dgvDetalle["PRO_porcentaje_IGV", fila.Index].Value = Convert.ToDouble(dt.Rows[0]["PorcentajeIGV"].ToString()); this.dgvDetalle["PRO_porcentaje_ISC", fila.Index].Value = Convert.ToDouble(dt.Rows[0]["PRO_porcentaje_ISC"].ToString()); this.dgvDetalle["Subunidades", fila.Index].Value = dt.Rows[0]["UME_multiplo"].ToString(); if (Convert.ToInt16(dt.Rows[0]["UME_multiplo"].ToString()) == 1) { this.dgvDetalle[dgvDetalle.Columns["DCO_cantidad_submultiplo"].Index, fila.Index].ReadOnly = true; this.dgvDetalle[dgvDetalle.Columns["DCO_cantidad_submultiplo"].Index, fila.Index].Value = ""; if (this.dgvDetalle[dgvDetalle.Columns["DCO_is_bonificacion"].Index, fila.Index].Value.ToString() == "NO") { this.dgvDetalle[dgvDetalle.Columns["DCO_cantidad_submultiplo"].Index, fila.Index].Style.BackColor = SystemColors.InactiveCaption; } else { this.dgvDetalle[dgvDetalle.Columns["DCO_cantidad_submultiplo"].Index, fila.Index].Style.BackColor = Color.Peru; } } else { this.dgvDetalle[dgvDetalle.Columns["DCO_cantidad_submultiplo"].Index, fila.Index].ReadOnly = false; this.dgvDetalle[dgvDetalle.Columns["DCO_cantidad_submultiplo"].Index, fila.Index].Style.BackColor = SystemColors.Window; } } } } } }
private void autocompletarCeldasGrilla(int indiceFila) { if (indiceFila == numeroFilasActual()) { balPRODUCTO obalPRODUCTO = new balPRODUCTO(); _frmBusqueda ventana = new _frmBusqueda(false, "buscarRegistro", obalPRODUCTO); DialogResult respuesta = ventana.ShowDialog(); if (respuesta == DialogResult.OK) { DataTable dt = new DataTable(); ePRODUCTO oePRODUCTO = new ePRODUCTO(); oePRODUCTO.PRO_codigo = ventana.pk; eSOCIO oeSOCIO = new eSOCIO(); oeSOCIO.SOC_codigo = Convert.ToInt32(this.txtCodigoSocio.Text); dt = balPRODUCTO.obtenerRegistroComplejo(oePRODUCTO, oeSOCIO); string impuestos = ""; if (dt.Rows.Count > 0) { impuestos = (Convert.ToDouble(dt.Rows[0]["PorcentajeIGV"].ToString()) > 0) ? "IGV[" + dt.Rows[0]["PorcentajeIGV"].ToString() + "] " : ""; impuestos += (Convert.ToDouble(dt.Rows[0]["PRO_porcentaje_isc"].ToString()) > 0) ? "ISC[" + dt.Rows[0]["PRO_porcentaje_isc"].ToString() + "] " : ""; //impuestos += (dt.Rows[0]["PRO_is_igv"].ToString() == "S") ? "IGV[18] " : ""; this.dgvDetalle["PRO_codigo", indiceFila].Value = dt.Rows[0]["PRO_codigo"].ToString(); this.dgvDetalle["PRO_descripcion", indiceFila].Value = dt.Rows[0]["PRO_descripcion"].ToString(); this.dgvDetalle["DCO_precio_unitario", indiceFila].Value = 0; this.dgvDetalle["Impuestos", indiceFila].Value = impuestos; this.dgvDetalle["DCO_is_bonificacion", indiceFila].Value = "NO"; //this.dgvDetalle["PRO_is_IGV", indiceFila].Value = dt.Rows[0]["PRO_is_IGV"].ToString(); this.dgvDetalle["PRO_porcentaje_IGV", indiceFila].Value = Convert.ToDouble(dt.Rows[0]["PorcentajeIGV"].ToString()); this.dgvDetalle["PRO_porcentaje_ISC", indiceFila].Value = Convert.ToDouble(dt.Rows[0]["PRO_porcentaje_ISC"].ToString()); this.dgvDetalle["Subunidades", indiceFila].Value = dt.Rows[0]["UME_multiplo"].ToString(); if (Convert.ToInt16(dt.Rows[0]["UME_multiplo"].ToString()) == 1) { this.dgvDetalle[dgvDetalle.Columns["DCO_cantidad_submultiplo"].Index, indiceFila].ReadOnly = true; this.dgvDetalle[dgvDetalle.Columns["DCO_cantidad_submultiplo"].Index, indiceFila].Value = ""; if (this.dgvDetalle[dgvDetalle.Columns["DCO_is_bonificacion"].Index, indiceFila].Value.ToString() == "NO") { this.dgvDetalle[dgvDetalle.Columns["DCO_cantidad_submultiplo"].Index, indiceFila].Style.BackColor = SystemColors.InactiveCaption; } else { this.dgvDetalle[dgvDetalle.Columns["DCO_cantidad_submultiplo"].Index, indiceFila].Style.BackColor = Color.Peru; } } else { this.dgvDetalle[dgvDetalle.Columns["DCO_cantidad_submultiplo"].Index, indiceFila].ReadOnly = false; this.dgvDetalle[dgvDetalle.Columns["DCO_cantidad_submultiplo"].Index, indiceFila].Style.BackColor = SystemColors.Window; } } this.dgvDetalle[dgvDetalle.Columns["DCO_cantidad"].Index, indiceFila].Value = 0; this.dgvDetalle[dgvDetalle.Columns["DCO_porcentaje_descuento"].Index, indiceFila].Value = 0; this.dgvDetalle[dgvDetalle.Columns["Fecha_produccion"].Index, indiceFila].Value = DateTime.Today.ToShortDateString(); this.dgvDetalle[dgvDetalle.Columns["Fecha_vencimiento"].Index, indiceFila].Value = DateTime.Today.ToShortDateString(); this.dgvDetalle.CurrentCell = this.dgvDetalle[dgvDetalle.Columns["DCO_cantidad"].Index, indiceFila]; this.dgvDetalle["isValido", indiceFila].Value = "N"; } } }
public override bool Guardar() { double d; int i; bool rpta = false; try { eSOCIO o = new eSOCIO(); //o.SOC_codigo = Int32.TryParse(this.txtCodigo.Text.Trim(), out i) ? Convert.ToInt32(this.txtCodigo.Text.Trim()) : -1; o.SOC_tipo_socio = this.cmbTipoSocio.Text.Trim(); o.SOC_apellido_paterno = this.txtApellidoPaterno.Text.Trim(); o.SOC_apellido_materno = this.txtApellidoMaterno.Text.Trim(); o.SOC_nombres = this.txtNombres.Text.Trim(); o.SOC_nombre_razon_social = this.txtRazonSocial.Text.Trim(); o.SOC_numero_documento = this.txtNumeroDocumento.Text.Trim(); o.SOC_direccion = this.txtDireccion.Text.Trim(); o.SOC_referencia_direccion = this.txtReferencia.Text.Trim(); o.SOC_telefono_fijo = this.txtTelefonoFijo.Text.Trim(); o.SOC_telefono_movil = this.txtTelefonoMovil.Text.Trim(); o.SOC_email = this.txtEmail.Text.Trim(); o.SOC_web = this.txtWeb.Text.Trim(); o.SOC_is_agente_retencion = this.chkRetencion.Checked ? "S" : "N"; o.SOC_is_agente_percepcion = this.chkPercepcion.Checked ? "S" : "N"; o.SOC_porcentaje_percepcion = Double.TryParse(this.cmbPorcentajePercepcion.Text.Trim(), out d) ? Convert.ToDouble(this.cmbPorcentajePercepcion.Text.Trim()) : (double?)null; o.SOC_is_validar_bonificacion = this.chkValidarBonificacion.Checked ? "S" : "N"; o.SOC_is_bonificacion_personalizada = this.chkBoniPersonal.Checked ? "S" : "N"; o.SOC_is_descuento_personalizado = this.chkDescuentoPersonal.Checked ? "S" : "N"; o.SOC_is_key_account = this.chkKeyAcc.Checked ? "S" : "N"; o.SOC_dias_credito = Int32.TryParse(this.cmbDiasCredito.Text.Trim(), out i) ? Convert.ToInt16(this.cmbDiasCredito.Text.Trim()) : -1; o.SOC_fecha_registro = Convert.ToDateTime(this.dtpFechaRegistro.Value.ToShortDateString()); o.SOC_linea_credito = Double.TryParse(this.nudLineaCredito.Text.Trim(), out d) ? Convert.ToDouble(this.nudLineaCredito.Text.Trim()) : -1; o.SOC_tipo_persona = this.cmbTipoPersona.Text.Trim(); o.SOC_is_activo = this.chkActivo.Checked ? "S" : "N"; o.SOC_comentario = this.txtComentario.Text.Trim(); o.SOC_tipo_documento_identidad = this.cmbTipoDocumentoId.Text.Trim(); o.SOC_latitud = String.IsNullOrWhiteSpace(this.txtLatitud.Text.Trim()) ? (double?)null : Convert.ToDouble(this.txtLatitud.Text.Trim()); o.SOC_longitud = String.IsNullOrWhiteSpace(this.txtLongitud.Text.Trim()) ? (double?)null : Convert.ToDouble(this.txtLongitud.Text.Trim()); o.LPR_codigo = String.IsNullOrWhiteSpace(this.cmbListaPrecio.Text) ? null : this.cmbListaPrecio.SelectedValue.ToString(); o.TNE_codigo = String.IsNullOrWhiteSpace(this.cmbTipoNegocio.Text) ? null : this.cmbTipoNegocio.SelectedValue.ToString(); o.CAN_codigo = String.IsNullOrWhiteSpace(this.cmbCanal.Text) ? null : this.cmbCanal.SelectedValue.ToString(); o.UBI_id = String.IsNullOrWhiteSpace(this.cmbUbigeo.Text) ? null : this.cmbUbigeo.SelectedValue.ToString(); o.ZON_codigo = String.IsNullOrWhiteSpace(this.cmbZona.Text) ? -1 : Convert.ToInt32(this.cmbZona.SelectedValue.ToString().Trim()); o.VEN_codigo = String.IsNullOrWhiteSpace(this.cmbVendedor.Text) ? (int?)null : Convert.ToInt32(this.cmbVendedor.SelectedValue.ToString().Trim()); o.TDO_codigo = String.IsNullOrWhiteSpace(this.cmbTipoDocumentoVenta.Text) ? null : this.cmbTipoDocumentoVenta.SelectedValue.ToString(); o.CPA_codigo = String.IsNullOrWhiteSpace(this.cmbCondicionPago.Text) ? null : this.cmbCondicionPago.SelectedValue.ToString(); if (balSOCIO.insertarRegistro(o)) { mensaje("guardar", ""); //mensaje("guardar",""); //MessageBox.Show("El registro fue guardado correctamente.", "SICO", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtCodigo.ReadOnly = true; rpta = true; } } catch (CustomException ex) { if (ex.tupla != null) { foreach (Control c in this.gpbInformacion.Controls) { foreach (var item in ex.tupla) { if (c.Tag != null && c.Tag.ToString() == item.name) { errValidacion.SetError(c, item.message.ToString()); } } foreach (Control x in c.Controls) { foreach (var item in ex.tupla) { if (x.Tag != null && x.Tag.ToString() == item.name) { errValidacion.SetError(x, item.message.ToString()); } } } } mensaje("subsanar", ""); } else { mensaje("corregir", ex.Message); } } catch (Exception ex) { MessageBox.Show("Ocurrió un error inesperado:\r\n" + ex.Message, "SICO", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(rpta); }
public static DataTable obtenerRegistroComplejo(ePRODUCTO oePRODUCTO, eSOCIO oeSOCIO) { return(_dalPRODUCTO.obtenerRegistroComplejo(oePRODUCTO, oeSOCIO)); }