private void modificar(p_cajaQ obj) { //Proceso para guardar datos..... DialogResult p = MessageBox.Show("¿Desea actualizar los cambios?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (p == DialogResult.No) { return; } string query = string.Format("update datos.p_cajaq set f_descuento = '{0}', rfc = '{1}',nombre_em = '{2}',secretaria = '{3}', descripcion = '{4}',descuentos = {5}, deldesc = {6},numdesc = {7}, plazo = {8}, imp_unit = {9}, imp_unit_cap = {10}, imp_unit_int = {11}, imp_unit_capl ='{12}', imp_unit_intl = '{13}', total = {14}, status = '{15}', fum = '{16}', hum = '{17}' where folio = {18}", obj.f_descuento, obj.rfc, obj.nombre_em, obj.secretaria, obj.descripcion, obj.descuentos, obj.deldescuentos, obj.numdesc, obj.plazo, obj.imp_unit, obj.imp_unit_cap, obj.imp_unit_int, obj.imp_unit_capl, obj.imp_unit_intl, obj.total, "T", obj.fum, obj.hum, obj.folio); if (globales.consulta(query, true)) { MessageBox.Show("Registro actualizado existosamente!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); limpiarCampos(false); btnGuardar.Enabled = false; btnNuevo.Enabled = true; btnModifica.Enabled = true; imprimir(obj); } }
private void guardar(p_cajaQ obj) { //Proceso para guardar datos..... DialogResult p = MessageBox.Show("¿Desea guardar cambios?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (p == DialogResult.No) { return; } string query = string.Format("select * from datos.p_cajaq where folio = {0}", txtFolio.Text); List <Dictionary <string, object> > resultado = globales.consulta(query); if (resultado.Count > 0) { MessageBox.Show("El registro ya esta insertado, dar clic en \"ACTUALIZAR INFORMACIÓN\" si requiere hacer cambios", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } query = string.Format("insert into datos.p_cajaq values ({0},'{1}','{2}','{3}','{4}','{5}',{6},{7},{8},{9},{10},{11},{12},'{13}','{14}',{15},'{16}','{17}','{18}',null)", obj.folio, obj.f_descuento, obj.rfc, obj.nombre_em, obj.secretaria, obj.descripcion, obj.descuentos, obj.deldescuentos, obj.numdesc, obj.plazo, obj.imp_unit, obj.imp_unit_cap, obj.imp_unit_int, obj.imp_unit_capl, obj.imp_unit_intl, obj.total, "T", obj.fum, obj.hum); if (globales.consulta(query, true)) { MessageBox.Show("Registro insertado existosamente!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); limpiarCampos(false); btnGuardar.Enabled = false; btnNuevo.Enabled = true; btnModifica.Enabled = true; imprimir(obj); } }
private p_cajaQ obtenerObjeto() { p_cajaQ obj = new p_cajaQ(); DateTime fecha = txtF_descuento.Value; string auxFecha = string.Format("{0}-{1}-{2}", fecha.Year, fecha.Month, fecha.Day); obj.folio = txtFolio.Text; obj.f_descuento = auxFecha; obj.rfc = txtRfc.Text; obj.nombre_em = txtNombre_em.Text; obj.secretaria = txtSecretaria.Text; obj.descripcion = txtdescripcion.Text; obj.descuentos = Convert.ToInt32(txtDescuentos.Text); obj.total = txtTotal.Text; obj.deldescuentos = Convert.ToInt32(txtDelDescuento.Text); obj.numdesc = Convert.ToInt32(txtNumDesc.Text); obj.plazo = Convert.ToInt32(txtPlazo.Text); obj.imp_unit = txtImp_unit.Text; obj.imp_unit_cap = txtImp_unitCap.Text; obj.imp_unit_int = txtImp_unitIntereses.Text; obj.imp_unit_intl = txtLetra2.Text; obj.imp_unit_capl = txtLetra1.Text; obj.fum = this.fum; obj.hum = this.hum; return(obj); }
private void guardar(p_cajaQ obj) { //Proceso para guardar datos..... DialogResult p = globales.MessageBoxQuestion("¿Desea guardar cambios?", "Aviso", this); if (p == DialogResult.No) { return; } string query = string.Empty; query = string.Format("insert into datos.p_cajaq values ({0},'{1}','{2}','{3}','{4}','{5}',{6},{7},{8},{9},{10},{11},{12},'{13}','{14}',{15},'{16}','{17}','{18}',null,'{19}')", obj.folio, obj.f_descuento, obj.rfc, obj.nombre_em, obj.secretaria, obj.descripcion, obj.descuentos, obj.deldescuentos, obj.numdesc, obj.plazo, obj.imp_unit, obj.imp_unit_cap, obj.imp_unit_int, obj.imp_unit_capl, obj.imp_unit_intl, obj.total, "T", obj.fum, obj.hum, this.esHipote); if (globales.consulta(query, true)) { globales.MessageBoxSuccess("Registro insertado existosamente!", "Aviso", this); limpiarCampos(false); btnGuardar.Enabled = false; btnNuevo.Enabled = true; btnModifica.Enabled = true; imprimir(obj); } }
private void modificar(p_cajaQ obj) { //Proceso para guardar datos..... DialogResult p = globales.MessageBoxQuestion("¿Desea actualizar los cambios?", "Aviso", this); if (p == DialogResult.No) { return; } string query = string.Format("update datos.p_cajaq set f_descuento = '{0}', rfc = '{1}',nombre_em = '{2}',secretaria = '{3}', descripcion = '{4}',descuentos = {5}, deldesc = {6},numdesc = {7}, plazo = {8}, imp_unit = {9}, imp_unit_cap = {10}, imp_unit_int = {11}, imp_unit_capl ='{12}', imp_unit_intl = '{13}', total = {14}, status = '{15}', fum = '{16}', hum = '{17}' where folio = {18} and t_prestamo = '{19}'", obj.f_descuento, obj.rfc, obj.nombre_em, obj.secretaria, obj.descripcion, obj.descuentos, obj.deldescuentos, obj.numdesc, obj.plazo, obj.imp_unit, obj.imp_unit_cap, obj.imp_unit_int, obj.imp_unit_capl, obj.imp_unit_intl, obj.total, "T", string.Format("{0:yyyy-MM-dd}", DateTime.Parse(obj.fum)), obj.hum, obj.folio, this.esHipote); if (globales.consulta(query, true)) { globales.MessageBoxSuccess("Registro actualizado existosamente!", "Aviso", this); limpiarCampos(false); btnGuardar.Enabled = false; btnNuevo.Enabled = true; btnModifica.Enabled = true; imprimir(obj); } }
private void imprimir(p_cajaQ obj) { DialogResult p = globales.MessageBoxQuestion("¿Desea visualizar el reporte?", "Reporte", this); if (p == DialogResult.No) { return; } string[] meses = { "", "ENERO", "FEBRERO", "MARZO", "ABRIL", "MAYO", "JUNIO", "JULIO", "AGOSTO", "SEPTIEMBRE", "OCTUBRE", "NOVIEMBRE", "DICIEMBRE" }; string total = globales.checarDecimales(obj.total); string nombre = string.Format("{0} ({1})", obj.nombre_em, obj.rfc); string descripcion = obj.descripcion; string query = globales.convertirNumerosLetras(Convert.ToString(total), true); string imp_unit_cap = string.Format("{0:C}", Convert.ToDouble(total)) + " (" + query + ")"; //string imp_unit_cap = string.Format("${0} ({1})",globales.checarDecimales(obj.imp_unit_cap),obj.imp_unit_capl); string texto1 = string.Format("POR CONCEPTO DEL LOS NÚMERO{1} {2} AL {3}/{4} DE SU PRESTAMO QUIROGRAFARIO DE FOLIO {5} {6}", (obj.descuentos == 1) ? "DEL" : "DE LOS", (obj.descuentos == 1) ? "" : "S", obj.deldescuentos, obj.numdesc, obj.plazo, obj.folio, (obj.descuentos < 0) ? "MÁS" : "MENOS -"); texto1 = this.esHipote == "H" ? texto1.Replace("QUIROGRAFARIO", "HIPOTECARIO"):texto1; string imp_unit_int = string.Format("${0} ({1})", obj.imp_unit_int, obj.imp_unit_intl); string moratorios = string.Format("{0}", (obj.descuentos < 0) ? "BONIFICADOS" : "MORATORIOS"); string[] arreglo = new string[3]; if (!string.IsNullOrWhiteSpace(obj.f_descuento)) { obj.f_descuento = obj.f_descuento.Replace(" 12:00:00 a. m.", ""); if (obj.f_descuento.Contains("/")) { arreglo = obj.f_descuento.Split('/'); } else { arreglo = obj.f_descuento.Split('-'); string aux = arreglo[2]; arreglo[2] = arreglo[0]; arreglo[0] = aux; } } string logo = globales.getImagen(globales.imagenesSispe.logoreportes); string fecha = string.Format("OAXACA DE JUAREZ, OAX., {0} DE {1} DE {2}", arreglo[0], meses[Convert.ToInt32(arreglo[1])], arreglo[2]); string firma = "L.A.E PATRICIA CRUZ GOMEZ"; string cargo = "JEFA DE DEPTO. DE PRESTACIONES ECONOMICAS"; object[][] parametros = new object[2][]; object[] header = { "total", "nombre", "descripcion", "impCap", "texto1", "imp_unit_int", "moratorios", "fecha", "firma", "cargo", "logo" }; object[] values = { total, nombre, descripcion, imp_unit_cap, texto1, imp_unit_int, moratorios, fecha, firma, cargo, logo }; parametros[0] = header; parametros[1] = values; globales.reportes("reportePagoCajaQ", "p_marcha", new object[] { }, "", false, parametros); }
private void btnGuardar_Click(object sender, EventArgs e) { if (validaciones()) { return; } p_cajaQ p = obtenerObjeto(); if (this.esInsertar) { guardar(p); } else { modificar(p); } }
private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(textBox1.Text)) { MessageBox.Show("Favor de seleccionar un folio para generar el reporte", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); textBox1.Focus(); return; } DialogResult p = MessageBox.Show("¿Desea generar el reporte?", "Reporte", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (p == DialogResult.No) { return; } p_cajaQ obj = new p_cajaQ(); string query = string.Format("select * from datos.p_cajaq where folio = {0}", textBox1.Text); List <Dictionary <string, object> > resultado = globales.consulta(query); Dictionary <string, object> item = resultado[0]; obj.total = Convert.ToString(item["total"]); obj.nombre_em = Convert.ToString(item["nombre_em"]); obj.folio = Convert.ToString(item["folio"]); obj.rfc = Convert.ToString(item["rfc"]); obj.secretaria = Convert.ToString(item["secretaria"]); obj.descripcion = Convert.ToString(item["descripcion"]); obj.imp_unit_cap = Convert.ToString(item["imp_unit_cap"]); obj.imp_unit_capl = Convert.ToString(item["imp_unit_capl"]); obj.descuentos = Convert.ToInt32(item["descuentos"]); obj.deldescuentos = Convert.ToInt32(item["deldesc"]); obj.numdesc = Convert.ToInt32(item["numdesc"]); obj.plazo = Convert.ToInt32(item["plazo"]); obj.imp_unit_int = Convert.ToString(item["imp_unit_int"]); obj.imp_unit_intl = Convert.ToString(item["imp_unit_intl"]); obj.f_descuento = Convert.ToString(item["f_descuento"]); string[] meses = { "", "ENERO", "FEBRERO", "MARZO", "ABRIL", "MAYO", "JUNIO", "JULIO", "AGOSTO", "SEPTIEMBRE", "OCTUBRE", "NOVIEMBRE", "DICIEMBRE" }; string total = globales.checarDecimales(obj.total); string nombre = string.Format("{0} ({1})", obj.nombre_em, obj.rfc); string descripcion = obj.descripcion; string imp_unit_cap = string.Format("${0} ({1})", globales.checarDecimales(obj.imp_unit_cap), obj.imp_unit_capl); string texto1 = string.Format("POR CONCEPTO {0} DEL{1} NÚMERO{1} {2} AL {3}/{4} DE SU PRESTAMO QUIROGRAFARIO DE FOLIO {5} {6}", (obj.descuentos == 1) ? "DEL" : "DE LOS", (obj.descuentos == 1) ? "" : "S", obj.deldescuentos, obj.numdesc, obj.plazo, obj.folio, (obj.descuentos < 0) ? "MÁS" : "MENOS -"); string imp_unit_int = string.Format("${0} ({1})", obj.imp_unit_int, obj.imp_unit_intl); string moratorios = string.Format("{0}", (obj.descuentos < 0) ? "BONIFICADOS" : "MORATORIOS"); string[] arreglo = new string[3]; if (!string.IsNullOrWhiteSpace(obj.f_descuento)) { obj.f_descuento = obj.f_descuento.Replace(" 12:00:00 a. m.", ""); if (obj.f_descuento.Contains("/")) { arreglo = obj.f_descuento.Split('/'); } else { arreglo = obj.f_descuento.Split('-'); string aux = arreglo[2]; arreglo[2] = arreglo[0]; arreglo[0] = aux; } } string fecha = string.Format("OAXACA DE JUAREZ, OAX., {0} DE {1} DE {2}", arreglo[0], meses[Convert.ToInt32(arreglo[1])], arreglo[2]); string firma = "L.A.E. PATRICIA CRUZ GOMEZ"; string cargo = "JEFE DE DEPTO. DE PRESTACIONES ECONOMICAS"; object[][] parametros = new object[2][]; object[] header = { "total", "nombre", "descripcion", "impCap", "texto1", "imp_unit_int", "moratorios", "fecha", "firma", "cargo" }; object[] values = { total, nombre, descripcion, imp_unit_cap, texto1, imp_unit_int, moratorios, fecha, firma, cargo }; parametros[0] = header; parametros[1] = values; globales.reportes("reportePagoCajaQ", "p_marcha", new object[] { }, "", false, parametros); }