private void bt_tit_buscar_Click(object sender, EventArgs e) { Frm_busca_cte buscar = new Frm_busca_cte('R', 'T'); buscar.ShowDialog(); if (buscar.id_cteSeleccionado != 0) { tb_tit_rg.Text = Convert.ToString(buscar.id_cteSeleccionado); tb_n_tit_rg.Text = Reg_Opera.Calcular_nom_cte(tb_tit_rg.Text, 'T'); } }
private void print_cab(PrintPageEventArgs ev) { xPos = Convert.ToInt32(leftMargin); yPos = Convert.ToInt32(topMargin) + 50; //+ (count * printFont.GetHeight(ev.Graphics)); while (count < linesPerPage) { ev.Graphics.DrawLine(new Pen(Color.Black, 2), new Point(xPos, yPos), new Point(xPos + 800, yPos)); count++; string n_deleg = ""; if (RegAct.delegacion == 'Y') { n_deleg = "YECLA"; } else { if (RegAct.delegacion == 'M') { n_deleg = "MURCIA"; } else { n_deleg = "ALBACETE"; } } line = "Delegación: " + n_deleg; ev.Graphics.DrawString(line, printFont, Brushes.Black, xPos, yPos + 50, new StringFormat()); line = "Nº Expediente: " + Convert.ToString(RegAct.n_reg); ev.Graphics.DrawString(line, printFont, Brushes.Black, xPos + 300, yPos + 50, new StringFormat()); count++; string n_cte = Reg_Opera.Calcular_nom_cte(Convert.ToString(RegAct.id_cte), 'C'); line = "Cliente: " + RegAct.id_cte; ev.Graphics.DrawString(line, printFont, Brushes.Black, xPos, yPos + 100, new StringFormat()); line = n_cte; ev.Graphics.DrawString(line, printFont, Brushes.Black, xPos + 300, yPos + 100, new StringFormat()); count++; string n_tit = Reg_Opera.Calcular_nom_cte(Convert.ToString(RegAct.id_titular), 'T'); line = "Titular: " + RegAct.id_titular; ev.Graphics.DrawString(line, printFont, Brushes.Black, xPos, yPos + 150, new StringFormat()); line = n_tit; ev.Graphics.DrawString(line, printFont, Brushes.Black, xPos + 300, yPos + 150, new StringFormat()); count++; count = 100; line = null; } }
private void tb_tit_rg_Validating(object sender, CancelEventArgs e) { //validamos que sea entero y que existe ese id_cte if (General.Validar_entero(tb_tit_rg.Text) == -1 || (Reg_Opera.Calcular_nom_cte(tb_tit_rg.Text, 'T') == " ")) { tb_tit_rg.Focus(); tb_tit_rg.SelectAll(); } else { tb_tit_rg.Text = tb_tit_rg.Text.Trim(); tb_n_tit_rg.Text = Reg_Opera.Calcular_nom_cte(tb_tit_rg.Text, 'T'); } }
private void Asigna_campos_rg(Registro pRegistro) { if (pRegistro.delegacion == 'Y') rb_del_y.Checked = true; else { if (pRegistro.delegacion == 'M') rb_del_m.Checked = true; else rb_del_a.Checked = true; } tb_n_reg.Text = Convert.ToString(pRegistro.n_reg); dtp_fec_rg.Value = pRegistro.fec_ent; tb_cte_rg.Text = Convert.ToString(pRegistro.id_cte); tb_n_cte_rg.Text = Reg_Opera.Calcular_nom_cte(tb_cte_rg.Text,'C'); tb_tit_rg.Text = Convert.ToString(pRegistro.id_titular); tb_n_tit_rg.Text = Reg_Opera.Calcular_nom_cte(tb_tit_rg.Text, 'T'); cb_sec_int.Text = pRegistro.seccion_int; cb_sec.Text = pRegistro.seccion; cb_tram.Text = pRegistro.t_tramite; tb_matri.Text = pRegistro.matricula; cb_estado.Text = pRegistro.estado; tb_fra.Text = Convert.ToString(pRegistro.factura); dtp_fec_fra.Value = pRegistro.fec_fra; tb_observ.Text = pRegistro.observacion; tb_base.Text = pRegistro.base_imp.ToString("N2");//Convert.ToString(pRegistro.base_imp); tb_p_iva.Text = Convert.ToString(pRegistro.p_iva); tb_tasa_fra.Text = pRegistro.tasa.ToString("N2");//Convert.ToString(pRegistro.tasa); tb_exp.Text = Convert.ToString(pRegistro.exp_tl); dtp_fec_pre.Value = pRegistro.fec_pre_exp; tb_tasa.Text = Convert.ToString(pRegistro.tasa_tl); tb_tipo.Text = pRegistro.tipo_tl; tb_c_serv.Text = pRegistro.cambio_serv; tb_bate_ant.Text = pRegistro.bate_ant; tb_nif.Text = pRegistro.nif; tb_d_col.Text = pRegistro.dcho_col.ToString("N2");//Convert.ToString(pRegistro.tasa_tl); if (pRegistro.t_cte_fra == 'C') cb_cte_fra.Text = "CTE."; else cb_cte_fra.Text = "TIT."; tb_t_fra.Text = Reg_Opera.Calcular_tot_fra(tb_base.Text, tb_p_iva.Text, tb_tasa_fra.Text); }
// The PrintPage event is raised for each page to be printed. private void printDocument1_PrintPage(object sender, PrintPageEventArgs ev) { printFont = new Font("Arial", 11); leftMargin = 50; //ev.MarginBounds.Left; topMargin = 20; //ev.MarginBounds.Top; StringFormat drawFormat = new StringFormat(); string line; // Calculate the number of lines per page. linesPerPage = 45; //Convert.ToInt32(ev.MarginBounds.Height /printFont.GetHeight(ev.Graphics)); n_pag++; n_lineas = 0; //short pinta_deleg=0; char deleg_old = 'Z'; //para cambio de cab. de delegacion //Pinta cabecera xPos = Convert.ToInt32(leftMargin); yPos = Convert.ToInt32(topMargin); //+ (n_lineas * printFont.GetHeight(ev.Graphics)); ev.Graphics.DrawRectangle(new Pen(Color.Black, 1), xPos, yPos, xPos + 60, yPos + 50); printFont = new Font("Arial", 16, FontStyle.Bold); ev.Graphics.DrawString("ASEGEST", printFont, Brushes.Black, xPos, yPos + 10); ev.Graphics.DrawString("YECMUR", printFont, Brushes.Black, xPos, yPos + 40); ev.Graphics.DrawLine(new Pen(Color.Black, 1), xPos, yPos + 70, xPos + 1050, yPos + 70); printFont = new Font("Arial", 14, FontStyle.Bold | FontStyle.Underline); ev.Graphics.DrawString("LISTADO DE REGISTROS:", printFont, Brushes.Black, xPos + 400, yPos + 90); n_lineas = n_lineas + 5; yPos = yPos + 90; while ((pos_reg < _registros.Count) && (n_lineas < linesPerPage)) { //cabecera string n_deleg = ""; if (deleg_old != _registros.ElementAt(pos_reg).delegacion) { if (_registros.ElementAt(pos_reg).delegacion == 'Y') { n_deleg = "YECLA"; } else { if (_registros.ElementAt(pos_reg).delegacion == 'M') { n_deleg = "MURCIA"; } else { n_deleg = "ALBACETE"; } } printFont = new Font("Arial", 12, FontStyle.Bold | FontStyle.Underline); ev.Graphics.DrawString("Delegación: " + n_deleg, printFont, Brushes.Black, xPos, yPos + 30); printFont = new Font("Arial", 10, FontStyle.Bold); ev.Graphics.DrawString("N.REG.", printFont, Brushes.Black, xPos, yPos + 60); ev.Graphics.DrawString("F.ENTREGA", printFont, Brushes.Black, xPos + 55, yPos + 60); ev.Graphics.DrawString("CLIENTE", printFont, Brushes.Black, xPos + 140, yPos + 60); ev.Graphics.DrawString("TITULAR", printFont, Brushes.Black, xPos + 390, yPos + 60); ev.Graphics.DrawString("SECCION", printFont, Brushes.Black, xPos + 640, yPos + 60); ev.Graphics.DrawString("TRAMITE", printFont, Brushes.Black, xPos + 780, yPos + 60); ev.Graphics.DrawString("ESTADO", printFont, Brushes.Black, xPos + 950, yPos + 60); ev.Graphics.DrawLine(new Pen(Color.Black, 2), xPos, yPos + 80, xPos + 1050, yPos + 80); n_lineas = n_lineas + 4; yPos = yPos + 80; deleg_old = _registros.ElementAt(pos_reg).delegacion; } //lineas printFont = new Font("Arial", 10, FontStyle.Regular); ev.Graphics.DrawString(Convert.ToString(_registros.ElementAt(pos_reg).n_reg), printFont, Brushes.Black, xPos, yPos + 10); ev.Graphics.DrawString(_registros.ElementAt(pos_reg).fec_ent.ToString("dd/MM/yyyy"), printFont, Brushes.Black, xPos + 65, yPos + 10); string n_cte = Reg_Opera.Calcular_nom_cte(Convert.ToString(_registros.ElementAt(pos_reg).id_cte), 'C'); ev.Graphics.DrawString(n_cte, printFont, Brushes.Black, xPos + 140, yPos + 10); string n_tit = Reg_Opera.Calcular_nom_cte(Convert.ToString(_registros.ElementAt(pos_reg).id_titular), 'T'); ev.Graphics.DrawString(n_tit, printFont, Brushes.Black, xPos + 390, yPos + 10); ev.Graphics.DrawString(_registros.ElementAt(pos_reg).seccion, printFont, Brushes.Black, xPos + 640, yPos + 10); ev.Graphics.DrawString(_registros.ElementAt(pos_reg).t_tramite.Substring(0, 24), printFont, Brushes.Black, xPos + 780, yPos + 10); ev.Graphics.DrawString(_registros.ElementAt(pos_reg).estado, printFont, Brushes.Black, xPos + 950, yPos + 10); string observ = "Obs: " + Convert.ToString(_registros.ElementAt(pos_reg).observacion); ev.Graphics.DrawString(observ.Substring(0, 100), printFont, Brushes.Black, xPos, yPos + 30); printFont = new Font("Arial", 10, FontStyle.Bold); line = "Nº Factura: " + Convert.ToString(_registros.ElementAt(pos_reg).factura); ev.Graphics.DrawString(line, printFont, Brushes.Black, xPos + 930, yPos + 30); printFont = new Font("Arial", 10, FontStyle.Regular); if (observ.Trim().Length > 100) { ev.Graphics.DrawString(observ.Substring(101), printFont, Brushes.Black, xPos + 40, yPos + 50); yPos = yPos + 20; n_lineas++; } ev.Graphics.DrawLine(new Pen(Color.Black, 1), xPos, yPos + 50, xPos + 1050, yPos + 50); yPos = yPos + 60; pos_reg++; n_lineas = n_lineas + 4; } //pie ev.Graphics.DrawLine(new Pen(Color.Black, 1), xPos, 800, xPos + 1050, 800); line = "Pag. " + Convert.ToString(n_pag); ev.Graphics.DrawString(line, printFont, Brushes.Black, xPos + 500, 805); // If more lines exist, print another page. if (pos_reg < _registros.Count)//(line != null) { ev.HasMorePages = true; } else { ev.HasMorePages = false; pos_reg = 0; //reinicio para la impresion en papel n_pag = 0; } }
private void Asigna_campos_rg(Registro pRegistro) { if (pRegistro.delegacion == 'Y') { rb_del_y.Checked = true; } else { if (pRegistro.delegacion == 'M') { rb_del_m.Checked = true; } else { rb_del_a.Checked = true; } } tb_n_reg.Text = Convert.ToString(pRegistro.n_reg); dtp_fec_rg.Value = pRegistro.fec_ent; tb_cte_rg.Text = Convert.ToString(pRegistro.id_cte); tb_n_cte_rg.Text = Reg_Opera.Calcular_nom_cte(tb_cte_rg.Text, 'C'); tb_tit_rg.Text = Convert.ToString(pRegistro.id_titular); tb_n_tit_rg.Text = Reg_Opera.Calcular_nom_cte(tb_tit_rg.Text, 'T'); cb_sec_int.Text = pRegistro.seccion_int; cb_sec.Text = pRegistro.seccion; cb_tram.Text = pRegistro.t_tramite; tb_matri.Text = pRegistro.matricula; cb_estado.Text = pRegistro.estado; tb_fra.Text = Convert.ToString(pRegistro.factura); dtp_fec_fra.Value = pRegistro.fec_fra; tb_observ.Text = pRegistro.observacion; tb_hono.Text = pRegistro.honorarios.ToString("N2"); //Convert.ToString(pRegistro.base_imp); tb_p_iva.Text = Convert.ToString(pRegistro.p_iva); tb_tasa_fra.Text = pRegistro.tasa.ToString("N2"); //Convert.ToString(pRegistro.tasa); tb_exp.Text = Convert.ToString(pRegistro.exp_tl); dtp_fec_pre.Value = pRegistro.fec_pre_exp; tb_tasa.Text = Convert.ToString(pRegistro.et_tasa); tb_tipo.Text = pRegistro.t_tasa; tb_c_serv.Text = pRegistro.cambio_serv; tb_bate_ant.Text = pRegistro.bate_ant; tb_nif.Text = pRegistro.nif; tb_d_col.Text = pRegistro.dcho_col.ToString("N2");//Convert.ToString(pRegistro.tasa_tl); if (pRegistro.t_cte_fra == 'C') { cb_cte_fra.Text = "CLIENTE"; } else { cb_cte_fra.Text = "TITULAR"; } tb_base_imp.Text = (pRegistro.honorarios + pRegistro.dcho_col).ToString("N2"); tb_tasa2.Text = Convert.ToString(pRegistro.et_tasa2); tb_tipo2.Text = pRegistro.t_tasa2; tb_tasa3.Text = Convert.ToString(pRegistro.et_tasa3); tb_tipo3.Text = pRegistro.t_tasa3; tb_tasa4.Text = Convert.ToString(pRegistro.et_tasa4); tb_tipo4.Text = pRegistro.t_tasa4; tb_descrip.Text = pRegistro.descripcion; tb_pdf.Text = pRegistro.ruta_pdf; tb_itasa.Text = Tasas_Opera.Saca_imp_tasa(Convert.ToInt16(dtp_fec_fra.Value.Year), pRegistro.t_tasa.Trim()).ToString("N2"); tb_itasa2.Text = Tasas_Opera.Saca_imp_tasa(Convert.ToInt16(dtp_fec_fra.Value.Year), pRegistro.t_tasa2.Trim()).ToString("N2"); tb_itasa3.Text = Tasas_Opera.Saca_imp_tasa(Convert.ToInt16(dtp_fec_fra.Value.Year), pRegistro.t_tasa3.Trim()).ToString("N2"); tb_itasa4.Text = Tasas_Opera.Saca_imp_tasa(Convert.ToInt16(dtp_fec_fra.Value.Year), pRegistro.t_tasa4.Trim()).ToString("N2"); //tb_tasa_fra.Text = (Convert.ToDecimal(tb_itasa.Text) + Convert.ToDecimal(tb_itasa2.Text) + Convert.ToDecimal(tb_itasa3.Text) + // Convert.ToDecimal(tb_itasa4.Text)).ToString("N2"); tb_t_fra.Text = Reg_Opera.Calcular_tot_fra(tb_base_imp.Text, tb_p_iva.Text, tb_tasa_fra.Text); }
// The PrintPage event is raised for each page to be printed. private void printDocument1_PrintPage(object sender, PrintPageEventArgs ev) { printFont = new Font("Arial", 12); leftMargin = 50; //ev.MarginBounds.Left; topMargin = 50; //ev.MarginBounds.Top; StringFormat drawFormat = new StringFormat(); // Calculate the number of lines per page. linesPerPage = Convert.ToInt32(ev.MarginBounds.Height / printFont.GetHeight(ev.Graphics)); //Pinta cabecera xPos = Convert.ToInt32(leftMargin); yPos = Convert.ToInt32(topMargin); //+ (count * printFont.GetHeight(ev.Graphics)); while (count < linesPerPage) { ev.Graphics.DrawRectangle(new Pen(Color.Black, 1), xPos, yPos, xPos + 60, yPos + 50); printFont = new Font("Arial", 16, FontStyle.Bold); ev.Graphics.DrawString("ASEGEST", printFont, Brushes.Black, xPos, yPos + 30); ev.Graphics.DrawString("YECMUR", printFont, Brushes.Black, xPos, yPos + 60); yPos = yPos + 100; ev.Graphics.DrawLine(new Pen(Color.Black, 1), xPos, yPos, xPos + 500, yPos); count = count + 3; string n_deleg = ""; if (RegAct.delegacion == 'Y') { n_deleg = "YECLA"; } else { if (RegAct.delegacion == 'M') { n_deleg = "MURCIA"; } else { n_deleg = "ALBACETE"; } } printFont = new Font("Arial", 14, FontStyle.Bold); ev.Graphics.DrawString("Delegación:", printFont, Brushes.Black, xPos, yPos + 30); ev.Graphics.DrawString(n_deleg, printFont, Brushes.Black, xPos + 120, yPos + 30); line = "Nº Registro: " + Convert.ToString(RegAct.n_reg); ev.Graphics.DrawString(line, printFont, Brushes.Black, xPos + 300, yPos + 30); count++; printFont = new Font("Arial", 12, FontStyle.Regular); ev.Graphics.DrawLine(new Pen(Color.Black, 1), xPos, yPos + 80, xPos + 500, yPos + 80); count++; string n_cte = Reg_Opera.Calcular_nom_cte(Convert.ToString(RegAct.id_cte), 'C'); ev.Graphics.DrawString("Cliente:", printFont, Brushes.Black, xPos, yPos + 120); ev.Graphics.DrawString(Convert.ToString(RegAct.id_cte), printFont, Brushes.Black, xPos + 120, yPos + 120); ev.Graphics.DrawString(n_cte.Trim(), printFont, Brushes.Black, xPos + 300, yPos + 120); count++; string n_tit = Reg_Opera.Calcular_nom_cte(Convert.ToString(RegAct.id_titular), 'T'); ev.Graphics.DrawString("Titular:", printFont, Brushes.Black, xPos, yPos + 180); ev.Graphics.DrawString(Convert.ToString(RegAct.id_titular), printFont, Brushes.Black, xPos + 120, yPos + 180); ev.Graphics.DrawString(n_tit.Trim(), printFont, Brushes.Black, xPos + 300, yPos + 180); count++; ev.Graphics.DrawString("Sección:", printFont, Brushes.Black, xPos, yPos + 240); ev.Graphics.DrawString(RegAct.seccion, printFont, Brushes.Black, xPos + 120, yPos + 240); count++; ev.Graphics.DrawString("Trámite:", printFont, Brushes.Black, xPos, yPos + 300); ev.Graphics.DrawString(RegAct.t_tramite, printFont, Brushes.Black, xPos + 120, yPos + 300); count++; ev.Graphics.DrawString("Estado:", printFont, Brushes.Black, xPos, yPos + 360); ev.Graphics.DrawString(RegAct.estado, printFont, Brushes.Black, xPos + 120, yPos + 360); count++; ev.Graphics.DrawLine(new Pen(Color.Black, 1), xPos, yPos + 410, xPos + 500, yPos + 410); count++; printFont = new Font("Arial", 14, FontStyle.Bold); ev.Graphics.DrawString("Expediente:", printFont, Brushes.Black, xPos, yPos + 450); ev.Graphics.DrawString(Convert.ToString(RegAct.exp_tl), printFont, Brushes.Black, xPos + 150, yPos + 450); //string.Format("{0:dd/MM/yyyy}",RegAct.fec_pre_exp) ev.Graphics.DrawString("Fec.Pres.:", printFont, Brushes.Black, xPos + 300, yPos + 450); ev.Graphics.DrawString(RegAct.fec_pre_exp.ToString("dd/MM/yyyy"), printFont, Brushes.Black, xPos + 400, yPos + 450); count++; printFont = new Font("Arial", 12, FontStyle.Regular); ev.Graphics.DrawLine(new Pen(Color.Black, 1), xPos, yPos + 500, xPos + 500, yPos + 500); count++; //salir del while y no imprimir + pgs. count = 100; line = null; } // If more lines exist, print another page. if (line != null) { ev.HasMorePages = true; } else { ev.HasMorePages = false; count = 0; //reinicio para la impresion en papel } }