Esempio n. 1
0
        private void dGV1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string gIdent = this.GetType().FullName + " " + System.Reflection.MethodBase.GetCurrentMethod().Name;

            GloblaVar.gUTIL.ATraza(gIdent + " Entrada a  " + sender.ToString());

            string Albaran = dGV1.CurrentRow.Cells["Albaran"].Value.ToString();
            string Fecha   = dGV1.CurrentRow.Cells["Fecha"].Value.ToString();
            string Año     = dGV1.CurrentRow.Cells["Anyo"].Value.ToString();
            //string Det = dGV1.CurrentRow.Cells["C_Det"].Value.ToString();
            //string BI = dGV1.CurrentRow.Cells["BI1"].Value.ToString();
            //string IVA = dGV1.CurrentRow.Cells["IVA1"].Value.ToString();
            //string RE = dGV1.CurrentRow.Cells["RE1"].Value.ToString();
            //string Total = dGV1.CurrentRow.Cells["Total"].Value.ToString();
            //string Vendedor = dGV1.CurrentRow.Cells["C_Vend"].Value.ToString();
            //Cobrar_Albaran(Albaran, Fecha, Año, Det, BI, IVA, RE, Total, Vendedor);


            int a = 2;

            if (a == 1)
            {
                MessageBox.Show("Fase de PRUEBAS. Todavia no facture abonos.");
                this.Close();
            }
            else
            {
                clase_ABONG_CABE    AlbAbono           = new clase_ABONG_CABE();
                ArrayList           Lista_Lineas_Abono = new ArrayList();
                clase_linea_factura linea_abono        = null;
                string idFactura = "";

                if (AlbAbono.CargaAlbaran(Albaran, Año))
                {
                    string error = Comprobaciones(AlbAbono);
                    if (error == "")
                    {
                        //idFactura = Funciones.FacturarAbono1(AlbAbono, "AB", "Albaran de Abono de " + Funciones.DameNomDet(AlbAbono.DetCod.ToString()));
                        idFactura = Funciones.FacturarAbono1(AlbAbono, "AB", "La presente FACTURA RECTIFICATIVA modifica la factura NÚMERO: " + AlbAbono.RectificaFact + "  AÑO: " + AlbAbono.RectificaAnyoFact + "  SERIE: " + AlbAbono.RectificaSerieFact);
                    }
                    else
                    {
                        MessageBox.Show(error);
                    }
                }       //if (AlbAbono.CargaAlbaran(Albaran,Año))



                if (idFactura != "")
                {
                    AlbAbono = null;
                    MessageBox.Show("La FACTURA RECTIFICATIVA se ha generado correctamente. \n \n Numero de FACTURA: " + idFactura);
                    CargarGrid();
                }
            }
        } //private void dGV1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        public void ComponAlbaran1()
        {
            string           gIdent  = this.GetType().FullName + " " + System.Reflection.MethodBase.GetCurrentMethod().Name + " ";
            clase_ABONG_CABE Albaran = new clase_ABONG_CABE();

            if (Albaran.CargaAlbaran(numalbaran, año))
            {
                GloblaVar.gIMAGEN_FONDO_TICKET = Image.FromFile(GloblaVar.gPATH_IMAGES_REMOTO + "\\plantilla_ticket_impreso.bmp");

                Graphics g = Graphics.FromImage(GloblaVar.gIMAGEN_FONDO_TICKET);
                // ******************** INICIO GRABAR Texto sobre la Imagen impresa **************************
                g.SmoothingMode           = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                g.CompositingQuality      = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                g.InterpolationMode       = System.Drawing.Drawing2D.InterpolationMode.High;
                formatoCentrado.Alignment = StringAlignment.Center;
                formatoDerecha.Alignment  = StringAlignment.Far;
                try
                {
                    ImprimeTituloColumnas(g);
                    g.DrawString(numalbaran, albaranFont, Brushes.Black, (float)(1270 * F), (float)(18 * F));
                    //g.DrawString("NºPEDIDO", articulos4Font, Brushes.Black,(float) ( 1150 * F),(float) ( 53 * F));
                    //g.DrawString(frmPrincipal.TxtNPedidoC.Text.ToString, articulos3Font, Brushes.Black,(float) ( 1270 * F),(float) ( 52 * F));
                    //    g.DrawString("NºPEDIDO:", articulos3Font, Brushes.Black, 730 * F, 547 * F)
                    //    g.DrawString(frmPrincipal.TxtNPedidoC.Text.ToString, articulos2Font, Brushes.Black, 838 * F, 541 * F)
                    g.DrawString(Albaran.Fecha.ToShortDateString(), FechaFont, Brushes.Black, (float)(1270 * F), (float)(70 * F));
                    g.DrawString(DateTime.Now.ToShortTimeString(), HoraFont, Brushes.Black, (float)(1270 * F), (float)(120 * F));
                    g.DrawString(Albaran.IdVendedor.ToString(), latinFaoFont, Brushes.Black, (float)(1270 * F), (float)(160 * F));
                    g.DrawString(Albaran.DetCod.ToString(), detallistaFont, Brushes.Black, (float)(890 * F), (float)(70 * F));
                    g.DrawString(Albaran.DetNom, nombreFont, Brushes.Black, (float)(390 * F), (float)(20 * F));
                    g.DrawString(Albaran.DetNif, articulosFont, Brushes.Black, 390 * F, 50 * F);
                    g.DrawString(Albaran.DetDireccion, articulosFont, Brushes.Black, 390 * F, 80 * F);
                    g.DrawString(Albaran.DetMun, articulosFont, Brushes.Black, 390 * F, 110 * F);

                    string cajas = "";
                    for (int i = 1; i < Albaran.NumLineas; i++)
                    {
                        if (Albaran.line[i].Cajas > 0)
                        {
                            cajas = Albaran.line[i].Cajas.ToString();
                        }
                        else
                        {
                            cajas = "";
                        }
                        g.DrawString(cajas, cantidadesFont, Brushes.Black, 429 * F, (230 + ((i - 1) * 52)) * F, formatoDerecha);
                        g.DrawString(Albaran.line[i].Kilos.ToString(), cantidadesFont, Brushes.Black, 569 * F, (230 + ((i - 1) * 52)) * F, formatoDerecha);
                        g.DrawString(Albaran.line[i].Artdes, articulos2Font, Brushes.Black, 635 * F, (230 + ((i - 1) * 52)) * F);
                        g.DrawString(Albaran.line[i].NomCie, latinFaoFont, Brushes.Black, 650 * F, (260 + ((i - 1) * 52)) * F);
                        //g.DrawString(frmPrincipal.TTraza_1.Text, articulos3Font, Brushes.Black, 1084 * F, 240 * F)
                        g.DrawString(Albaran.line[i].Precio.ToString("##,##0.00"), cantidadesFont, Brushes.Black, 1320 * F, (230 + ((i - 1) * 52)) * F, formatoDerecha);
                        g.DrawString(Albaran.line[i].Importe.ToString("##,##0.00"), cantidadesFont, Brushes.Black, 1464 * F, (230 + ((i - 1) * 52)) * F, formatoDerecha);
                    }  // for . fin de recorrido de las lineas
                    //decimal a = Albaran.IVA1  ;
                    g.DrawString(Albaran.BI1.ToString("##,##0.00"), subtotFont, Brushes.Black, 1464 * F, 450 * F, formatoDerecha);
                    g.DrawString(Albaran.IVA1.ToString("##,##0.00"), subtotFont, Brushes.Black, 1464 * F, 480 * F, formatoDerecha);
                    g.DrawString(Albaran.RE1.ToString("##,##0.00"), subtotFont, Brushes.Black, 1464 * F, 510 * F, formatoDerecha);
                    g.DrawString(Albaran.Total.ToString("##,##0.00"), totalFont, Brushes.Black, 1464 * F, 537 * F, formatoDerecha);
                    g.DrawString("ABONO SIN GEN.", detallistaFont, Brushes.Black, 680 * F, 460 * F);

                    string pathImagenTicket = GloblaVar.gPATH_IMAGES_REMOTO + "\\ABONOS\\" + DateTime.Today.ToString("yyyyMMdd") + "_" + Albaran.Albaran.ToString("000000#") + ".gif";
                    GloblaVar.gIMAGEN_FONDO_TICKET.Save(pathImagenTicket, System.Drawing.Imaging.ImageFormat.Gif);
                    GloblaVar.gUTIL.ATraza(gIdent + "Generado el albarán " + pathImagenTicket);
                }
                catch (Exception ex)
                {
                    GloblaVar.gUTIL.ATraza(gIdent + ex.ToString());
                }
            }
        }  //private void ComponAlbaran1