public Int32 InsertarPresupuesto(SqlConnection con, SqlTransaction Transaccion, double Total, DateTime Fecha , Int32?CodVendedor, DateTime?FechaRendicion) { cFunciones fun = new cFunciones(); string sql = " insert into Presupuesto(Total,Fecha,CodVendedor"; sql = sql + ",FechaRendicion,FechaRendicionTexto)"; sql = sql + " values (" + Total.ToString().Replace(",", "."); sql = sql + "," + "'" + Fecha.ToShortDateString() + "'"; if (CodVendedor != null) { sql = sql + "," + CodVendedor.ToString(); } else { sql = sql + ",null"; } if (FechaRendicion != null) { sql = sql + "," + "'" + fun.FormatoFechaDMA(Convert.ToDateTime(FechaRendicion)) + "'"; sql = sql + "," + "'" + fun.FormatoFechaDMA(Convert.ToDateTime(FechaRendicion)) + "'"; } else { sql = sql + ",null,null"; } sql = sql + ")"; return(cDb.EjecutarEscalarTransaccion(con, Transaccion, sql)); }
public DataTable GetResumenVentas(DateTime FechaDesde, DateTime FechaHasta) { cFunciones fun = new cFunciones(); string sql = " SELECT MONTH(FECHA) as Mes, YEAR(FECHA) as Anio,SUM(TOTAL) as Total, "; sql = sql + " sum(totalcomision) as TotalComision, sum(TotalVentaComision) as TotalRendido"; sql = sql + " FROM VENTA "; sql = sql + " where fecha>=" + "'" + fun.FormatoFechaDMA(FechaDesde) + "'"; sql = sql + " and fecha<=" + "'" + fun.FormatoFechaDMA(FechaHasta) + "'"; sql = sql + " GROUP BY MONTH(FECHA), YEAR(FECHA)"; return(cDb.GetDatatable(sql)); }
public DataTable GetPresupuestoxFecha(DateTime FechaDesde, DateTime FechaHasta, string Apellido) { cFunciones fun = new cFunciones(); string sql = "select p.CodPresupuesto,p.Fecha,v.Apellido,v.Nombre,p.Total"; sql = sql + " from Presupuesto p, Vendedor v"; sql = sql + " where p.CodVendedor=v.CodVendedor"; sql = sql + " and p.Fecha>=" + "'" + fun.FormatoFechaDMA(FechaDesde) + "'"; sql = sql + " and p.Fecha<=" + "'" + fun.FormatoFechaDMA(FechaHasta) + "'"; if (Apellido != "") { sql = sql + " and v.Apellido like " + "'%" + Apellido + "%'"; } sql = sql + " order by p.CodPresupuesto desc"; return(cDb.GetDatatable(sql)); }
public Int32 InsertarVenta(SqlConnection con, SqlTransaction Transaccion, Int32?CodVendedor, DateTime Fecha, Int32 CodPresupuesto, Double Total, Double TotalComision, Double TotalVentaComision) { cFunciones fun = new cFunciones(); string sql = "insert into Venta(CodVendedor,Fecha,CodPresupuesto,Total,TotalComision,TotalVentaComision)"; if (CodVendedor != null) { sql = sql + " values(" + CodVendedor.ToString(); } else { sql = sql + " Values(null"; } sql = sql + "," + "'" + fun.FormatoFechaDMA(Fecha) + "'"; sql = sql + "," + CodPresupuesto.ToString(); sql = sql + "," + Total.ToString().Replace(",", "."); sql = sql + "," + TotalComision.ToString().Replace(",", "."); sql = sql + "," + TotalVentaComision.ToString().Replace(",", "."); sql = sql + ")"; return(cDb.EjecutarEscalarTransaccion(con, Transaccion, sql)); }