示例#1
0
 public static string GetFacturaHtml(Factura f)
 {
     string html = "";
     string plantilla = @"
     <div class='panel panel-default'>
         <div class='panel-heading'>
             <a data-toggle='collapse' data-parent='#accordion' href='#collapse{0}{1}'>
                 <h4>Factura {0}-{1:0000000} de {2:dd/MM/yyyy} # {3:#,###,##0.00} + {4:#,###,##0.00} = {5:#,###,##0.00 €}</h4>
             </a>
         </div>
         <div id='collapse{0}{1}' class='panel-collapse collapse'>
             <div class='panel-body'>
                 <table class='table table-bordered'>
                     <tr class='info'>
                         <th>Albaran</th>
                         <th>Linea</th>
                         <th>Artículo</th>
                         <th class='text-right'>Cantidad</th>
                         <th class='text-right'>Precio</th>
                         <th class='text-right'>Dto1 (%)</th>
                         <th class='text-right'>Dto2 (%)</th>
                         <th class='text-right'>Importe</th>
                     </tr>
                     {6}
                 </table>
             </div>
         </div>
     </div>
     ";
     string plantillaLinea = @"
     <tr>
         <td>{10}</td>
         <td>{2}</td>
         <td>{3}</td>
         <td class='text-right'>{5:##0.00}</td>
         <td class='text-right'>{4:###,##0.00}</td>
         <td class='text-right'>{6:0.00}</td>
         <td class='text-right'>{7:0.00}</td>
         <td class='text-right'>{8:##,###,##0.00}</td>
     </tr>
     ";
     string plantillaAlb = @"
     <tr>
         <td colspan='7'>
             <strong>Albaran: </strong>{0}
         </td>
     </tr>
     ";
     // Cargar las líneas
     string lineas = "";
     string codAlbar = "";
     string codAlbarOld = "";
     string showAlbar;
     foreach (LinFactura lf in f.LineasFactura)
     {
         codAlbar = String.Format("{0}-{1:0000000}", lf.CodTipoa, lf.NumAlbar);
         if (codAlbar != codAlbarOld)
         {
             showAlbar = codAlbar;
             if (codAlbar == "-0000000")
                 showAlbar = "";
             codAlbarOld = codAlbar;
         }
         else
         {
             showAlbar = "";
         }
         lineas += String.Format(plantillaLinea, lf.CodTipoa, lf.NumAlbar,
             lf.NumLinea, lf.NomArtic, lf.PrecioAr, lf.Cantidad, lf.DtoLine1, lf.DtoLine2, lf.Importel, codAlbar, showAlbar);
     }
     html = String.Format(plantilla, f.CodTipom, f.NumFactu,
         f.FecFactu, f.Bases, f.Cuotas, f.TotalFac, lineas);
     return html;
 }
示例#2
0
 public static Factura GetFactura(MySqlDataReader rdr)
 {
     if (rdr.IsDBNull(rdr.GetOrdinal("NUMFACTU")))
         return null;
     Factura f = new Factura();
     f.CodTipom = rdr.GetString("CODTIPOM");
     f.NumFactu = rdr.GetInt32("NUMFACTU");
     f.FecFactu = rdr.GetDateTime("FECFACTU");
     f.Bases = rdr.GetDecimal("BASES");
     f.Cuotas = rdr.GetDecimal("CUOTAS");
     f.TotalFac = rdr.GetDecimal("TOTALFAC");
     return f;
 }