public static Albaran GetAlbaran(MySqlDataReader rdr) { if (rdr.IsDBNull(rdr.GetOrdinal("NUMALBAR"))) return null; Albaran a = new Albaran(); a.CodTipom = rdr.GetString("CODTIPOM"); a.NumAlbar = rdr.GetInt32("NUMALBAR"); a.FechaAlb = rdr.GetDateTime("FECHAALB"); a.TotalAlb = rdr.GetDecimal("TOTALALB"); return a; }
public static string GetAlbaranHtml(Albaran a) { string html = ""; string plantilla = @" <div class='panel panel-default'> <div class='panel-heading'> <a data-toggle='collapse' data-parent='#accordion' href='#collapse{0}'> <h4>Albaran {5} de {1:dd/MM/yyyy} # {3:#,###,##0.00 €}</h4> </a> </div> <div id='collapse{0}' class='panel-collapse collapse'> <div class='panel-body'> <table class='table table-bordered'> <tr class='info'> <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> {4} </table> </div> </div> </div> "; string plantillaLinea = @" <tr> <td>{0}</td> <td>{1}</td> <td class='text-right'>{3:##0.00}</td> <td class='text-right'>{2:###,##0.00}</td> <td class='text-right'>{4:0.00}</td> <td class='text-right'>{5:0.00}</td> <td class='text-right'>{6:##,###,##0.00}</td> </tr> "; // Cargar las líneas string lineas = ""; foreach (LinAlbaran lp in a.LineasAlbaran) { lineas += String.Format(plantillaLinea, lp.NumLinea, lp.NomArtic, lp.PrecioAr, lp.Cantidad, lp.DtoLine1, lp.DtoLine2, lp.Importel); } string codAlbar = String.Format("{0}-{1:0000000}", a.CodTipom, a.NumAlbar); if (codAlbar == "-0000000") codAlbar = ""; html = String.Format(plantilla, a.NumAlbar, a.FechaAlb, a.CodTipom, a.TotalAlb, lineas, codAlbar); return html; }