private void bunifuImageButton1_Click(object sender, EventArgs e) { int nro_ent = 0; nro_ent = Convert.ToInt32(DB_socios.entregas_mochilas.Max(x => x.numero_entrega).ToString() + 1); var im = from a in DB_socios.impresion_comprobante where a.nro_entrega >= 0 select a; //limpio la tabla de impresion foreach (var item in im) { DB_socios.impresion_comprobante.DeleteOnSubmit(item); DB_socios.SubmitChanges(); } foreach (DataGridViewRow fila in dgv_familiar_a_cargo_mochilas.Rows) { if ((fila.Cells["entregar_mochila"].Value != null) && (Convert.ToInt32(fila.Cells["entregada"].Value.ToString()) == 1)) { //grabo en impresiones_comprobantes impresion_comprobante imp_comp = new impresion_comprobante(); imp_comp.nro_entrega = nro_ent; imp_comp.nro_socio = Convert.ToInt32(txt_nro_socio.Text); imp_comp.socio_apenom = txt_ape_nom.Text; imp_comp.socio_dni = txt_dni_socio.Text; imp_comp.socio_empresa = txt_empresa.Text; imp_comp.benef_apenom = fila.Cells["ayn"].Value.ToString(); imp_comp.benef_dni = fila.Cells["dni_beneficiario"].Value.ToString(); imp_comp.benef_edad = Convert.ToInt32(fila.Cells["edad"].Value.ToString()); string mo = fila.Cells["mochila"].Value.ToString(); imp_comp.benef_tipo_mochila = mo.Substring(12, mo.Length - 12); imp_comp.benef_sexo = DB_soc_mysql.maeflia.Where(x => x.MAEFLIA_CODFLIAR == Convert.ToInt16(fila.Cells["codigo_familiar"].Value.ToString())).Single().MAEFLIA_SEXO.ToString(); imp_comp.benef_legajo = DB_socios.entregas_mochilas.Where(x => x.cod_fliar == Convert.ToInt16(fila.Cells["codigo_familiar"].Value.ToString())).Single().legajo; if (DB_socios.entregas_mochilas.Where(x => x.cod_fliar == Convert.ToInt16(fila.Cells["codigo_familiar"].Value.ToString())).Single().fondo_desempleo != null) { imp_comp.benef_fdo_desempleo = "SI"; } else { imp_comp.benef_fdo_desempleo = "NO"; } imp_comp.comentario = DB_socios.entregas_mochilas.Where(x => x.cod_fliar == Convert.ToInt16(fila.Cells["codigo_familiar"].Value.ToString())).Single().comentario; DB_socios.impresion_comprobante.InsertOnSubmit(imp_comp); DB_socios.SubmitChanges(); calcular_cant_entregas(); calcular_totales(); } } reportes frm_reportes = new reportes(); frm_reportes.ShowDialog(); }
private void btn_imprimir_notificacion_Click(object sender, EventArgs e) { Func_Utiles func_Utiles = new Func_Utiles(); func_Utiles.limpiar_tabla_impresion(); num2words num_a_letras = new num2words(); using (var context = new lts_sindicatoDataContext()) { var imp = from a in context.impresion_actas select a; string actas = string.Empty; foreach (DataGridViewRow fila in dgv_actas_estudio.Rows) { if (Convert.ToBoolean(fila.Cells["Imput"].Value)) { impresion_comprobante im = new impresion_comprobante(); im.empresa = lbl_razon_social.Text; im.cuit = lbl_cuit.Text; im.domicilio = lbl_domicilio.Text; im.localidad = lbl_localidad.Text; im.COL1EMPRESA = lbl_codigo_postal.Text; //Codigo postal de la empresa im.nro_socio = Convert.ToInt16(fila.Cells["num_acta"].Value); //Numero de ACTA im.aporte_ley = Convert.ToDecimal(fila.Cells["importe_act"].Value); //Valor del acta actualizada im.aporte_socio = Convert.ToDecimal(lbl_total_deuda.Text); //valor total de la deuda actualizada im.COL1NOMBRE = num_a_letras.enletras(lbl_total_deuda.Text); // valor en letras de la deuda actualizada im.COL2EMPRESA = lbl_actas.Text; // Actas involucradas im.COL2NOMBRE = fila.Cells["num_acta"].Value.ToString() + cbx_estudios.SelectedValue.ToString(); // numero de Notifiacion de deuda. cmpuesta por NºACTA + codigo de Inspectoro estudio juridico im.COL2NROSOCIO = dtp_vencimiento.Value.Date.ToShortDateString(); // fecha de vencimiento de la certificacion de deuda //im.telefono = lbl_total_fojas.Text; // cantidad de fojas que compone la nota context.impresion_comprobante.InsertOnSubmit(im); } } context.SubmitChanges(); } reportes frm_reportes = new reportes(); frm_reportes.nombreReporte = "certificado_de_deuda"; frm_reportes.Show(); }
private void btn_entrgar_mochila_Click(object sender, EventArgs e) { int b = 0; int nro_ent = 0; nro_ent = Convert.ToInt32(DB_socios.entregas_mochilas.Max(x => x.numero_entrega).ToString() + 1); var im = from a in DB_socios.impresion_comprobante where a.nro_entrega >= 0 select a; //limpio la tabla de impresion foreach (var item in im) { DB_socios.impresion_comprobante.DeleteOnSubmit(item); DB_socios.SubmitChanges(); } foreach (DataGridViewRow fila in dgv_familiar_a_cargo_mochilas.Rows) { if ((fila.Cells["entregar_mochila"].Value != null) && (Convert.ToInt32(fila.Cells["entregada"].Value.ToString()) == 0)) { // busco en la tabla entregas_mochilas por codfliar y verifico si se encontro var se_recibio_documentacion = DB_socios.entregas_mochilas.Where(x => x.cod_fliar == Convert.ToInt16(fila.Cells["codigo_familiar"].Value.ToString())); if (se_recibio_documentacion.Count() > 0) { // Ya esta encontrada la mochila de ese beneficiario y verifico no fue entregada var se_recibio_documentacion_1 = DB_socios.entregas_mochilas.Where(x => x.cod_fliar == Convert.ToInt16(fila.Cells["codigo_familiar"].Value.ToString())).Single(); if (se_recibio_documentacion_1.entrega_mochila is null) { // se encontro el registro en la tabla de entregas_mochilas por que se recibio documentacion y no fue entragada aun, entonces cargo la entrega solamente entregas_mochilas entrega_mochi_1 = DB_socios.entregas_mochilas.Where(x => x.cod_fliar == Convert.ToInt16(fila.Cells["codigo_familiar"].Value.ToString())).Single(); entrega_mochi_1.entrega_mochila = true; entrega_mochi_1.fecha_entrega_mochila = DateTime.Now; DB_socios.SubmitChanges(); } } else { // NO se encontro el registro en la tabla de entregas_mochilas entonces cargo los datos necesarios entregas_mochilas entrega_mochi = new entregas_mochilas(); entrega_mochi.cod_fliar = Convert.ToInt16(fila.Cells["codigo_familiar"].Value.ToString()); entrega_mochi.nro_doc_fliar = Convert.ToInt32(fila.Cells["dni_beneficiario"].Value.ToString()); entrega_mochi.recibe_docum = true; entrega_mochi.fecha_recepcion_docum = DateTime.Now; entrega_mochi.tipo_mochila = Convert.ToInt16(fila.Cells["mochila"].Value.ToString().Substring(0, 1)); entrega_mochi.codigo_usuario_recepcion = 0; entrega_mochi.legajo = txt_legajo.Text; if (chk_fdo_desempleo.Checked) { entrega_mochi.fondo_desempleo = 1; } entrega_mochi.comentario = txt_comentario.Text; entrega_mochi.entrega_mochila = true; entrega_mochi.fecha_entrega_mochila = DateTime.Now; DB_socios.entregas_mochilas.InsertOnSubmit(entrega_mochi); DB_socios.SubmitChanges(); calcular_cant_entregas(); } //grabo en impresiones_comprobantes impresion_comprobante imp_comp = new impresion_comprobante(); imp_comp.nro_entrega = nro_ent; imp_comp.nro_socio = Convert.ToInt32(txt_nro_socio.Text); imp_comp.socio_apenom = txt_ape_nom.Text; imp_comp.socio_dni = txt_dni_socio.Text; imp_comp.socio_empresa = txt_empresa.Text; imp_comp.benef_apenom = fila.Cells["ayn"].Value.ToString(); imp_comp.benef_dni = fila.Cells["dni_beneficiario"].Value.ToString(); imp_comp.benef_edad = Convert.ToInt32(fila.Cells["edad"].Value.ToString()); imp_comp.benef_tipo_mochila = fila.Cells["mochila"].Value.ToString().Substring(3); imp_comp.benef_sexo = DB_soc_mysql.maeflia.Where(x => x.MAEFLIA_CODFLIAR == Convert.ToInt16(fila.Cells["codigo_familiar"].Value.ToString())).Single().MAEFLIA_SEXO.ToString(); imp_comp.benef_legajo = DB_socios.entregas_mochilas.Where(x => x.cod_fliar == Convert.ToInt16(fila.Cells["codigo_familiar"].Value.ToString())).Single().legajo; if (DB_socios.entregas_mochilas.Where(x => x.cod_fliar == Convert.ToInt16(fila.Cells["codigo_familiar"].Value.ToString())).Single().fondo_desempleo != null) { imp_comp.benef_fdo_desempleo = "SI"; } else { imp_comp.benef_fdo_desempleo = "NO"; } imp_comp.comentario = DB_socios.entregas_mochilas.Where(x => x.cod_fliar == Convert.ToInt16(fila.Cells["codigo_familiar"].Value.ToString())).Single().comentario; DB_socios.impresion_comprobante.InsertOnSubmit(imp_comp); DB_socios.SubmitChanges(); calcular_cant_entregas(); b = 1; } } if (b == 1) { reportes frm_reportes = new reportes(); frm_reportes.ShowDialog(); } }