public List <prd_DespachoDetalle_Info> ObtenerDespachoDetalle_para_GuiaRemision(decimal IdDespacho, int idempresa, int IdSucursal) { try { EntitiesProduccion_Cidersus OEProduccion = new EntitiesProduccion_Cidersus(); List <prd_DespachoDetalle_Info> lM = new List <prd_DespachoDetalle_Info>(); var select = from C in OEProduccion.prd_DespachoDet let k = new { //try this if you need a date field // p.SaleDate.Date.AddDays(-1 *p.SaleDate.Day - 1) Id_Empresa = C.IdEmpresa, Id_Sucursal = C.IdSucursal, Id_Despacho = C.IdDespacho, Id_Product = C.IdProducto } where C.IdEmpresa == idempresa && C.IdSucursal == IdSucursal && C.IdDespacho == IdDespacho //orderby C.Secuencia ascending group C by k into t select new { IdEmpresa = t.Key.Id_Empresa, Id_Sucursal = t.Key.Id_Sucursal, Id_Despacho = t.Key.Id_Sucursal, IdProduct = t.Key.Id_Product, Qty = t.Sum(p => p.Cantidad) }; foreach (var item in select) { prd_DespachoDetalle_Info Info = new prd_DespachoDetalle_Info(); Info.IdEmpresa = item.IdEmpresa; Info.IdSucursal = item.Id_Sucursal; Info.IdDespacho = item.Id_Despacho; Info.IdProducto = item.IdProduct; //Info.peso = Convert.ToDecimal(item.peso); //Info.precio = Convert.ToDecimal(item.precio); Info.Cantidad = item.Qty; //Info.Observacion = item.Observacion; //Info.precio = Convert.ToDecimal(item.precio); lM.Add(Info); } return(lM); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); mensaje = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.ToString()); } }
public List <prd_DespachoDetalle_Info> ObtenerDespachoDetalle(decimal IdDespacho, int idempresa, int IdSucursal) { try { EntitiesProduccion_Cidersus OEProduccion = new EntitiesProduccion_Cidersus(); List <prd_DespachoDetalle_Info> lM = new List <prd_DespachoDetalle_Info>(); var select = from C in OEProduccion.prd_DespachoDet where C.IdEmpresa == idempresa && C.IdSucursal == IdSucursal && C.IdDespacho == IdDespacho orderby C.Secuencia ascending select C; foreach (var item in select) { prd_DespachoDetalle_Info Info = new prd_DespachoDetalle_Info(); Info.IdEmpresa = item.IdEmpresa; Info.IdSucursal = item.IdSucursal; Info.IdDespacho = item.IdDespacho; Info.Secuencia = item.Secuencia; Info.IdOrdenTaller = item.IdOrdenTaller; Info.Hora = item.Hora; Info.IdProducto = item.IdProducto; Info.peso = Convert.ToDecimal(item.peso); Info.precio = Convert.ToDecimal(item.precio); Info.CodigoBarraMaestro = item.CodigoBarraMaestro; Info.CodigoBarra = item.CodigoBarra; Info.Cantidad = item.Cantidad; Info.Observacion = item.Observacion; Info.precio = Convert.ToDecimal(item.precio); lM.Add(Info); } return(lM); } catch (Exception ex) { string arreglo = ToString(); tb_sis_Log_Error_Vzen_Data oDataLog = new tb_sis_Log_Error_Vzen_Data(); tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now); mensaje = ex.ToString() + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.ToString()); } }