public Models_InventarioPlanilla get_InventarioPlanilla(string cod_tda, string fecha) { Models_InventarioPlanilla lista = null; List <Lista_InventarioPlanilla> lista1 = null; var dt = new DataTable(); var sqlquery = "USP_REPORTE_INVENTARIO_PLANILLA"; try { using (var cn = new SqlConnection(Ent_Conexion.conexionPosPeru)) { if (cn.State == 0) { cn.Open(); } using (var cmd = new SqlCommand(sqlquery, cn)) { cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@CODTDA", cod_tda); cmd.Parameters.AddWithValue("@FEC_EVAL", fecha); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { DataSet ds = new DataSet(); da.Fill(ds); lista1 = new List <Lista_InventarioPlanilla>(); lista1 = (from DataRow dr in ds.Tables[0].Rows select new Lista_InventarioPlanilla() { COD_TIENDA = dr["COD_TIENDA"].ToString(), ARTICULO = dr["ARTICULO"].ToString(), CALIDAD = dr["CALIDAD"].ToString(), MEDIDA = dr["MEDIDA"].ToString(), STK_MED_LAT = dr["STK_MED_LAT"].ToString(), PPLANILLA = string.IsNullOrEmpty(dr["PPLANILLA"].ToString()) ? 0 : Convert.ToDecimal(dr["PPLANILLA"].ToString()), STOCK = string.IsNullOrEmpty(dr["STOCK"].ToString()) ? 0 : Convert.ToDecimal(dr["STOCK"].ToString()), VALOR = string.IsNullOrEmpty(dr["VALOR"].ToString()) ? 0 : Convert.ToDecimal(dr["VALOR"].ToString()), TALLA = dr["TALLA"].ToString(), FECHA = dr["FECHA"].ToString(), CATEG = dr["CATEG"].ToString(), SUBCATEG = dr["SUBCATEG"].ToString(), TIPO = dr["TIPO"].ToString(), }).ToList(); lista = new Models_InventarioPlanilla(); lista.ListInventarioPlanilla = lista1; } } } } catch (Exception exc) { lista = null; } return(lista); }
public ActionResult ShowGenericReportInventarioPlanillaInNewWin(string tda, string fecIni) { try { string CodTda = ""; var ip = new Dat_InventarioPlanilla(); HttpContext.Session["ReportName"] = "ReporteInventarioPlanilla.rpt"; //if (Session["Tienda"] != null) //{ // CodTda = Session["Tienda"].ToString(); //} //else //{ // //CodTda = "-1"; // CodTda = tda; //} //ReporteVentasEcommerce ModeloRepVentaEcommerce = ec.get_ecommerce_reporteventa(CodTda, fecIni, FecFin, tipo); Models_InventarioPlanilla ModeloInventarioPlanilla = ip.get_InventarioPlanilla(tda, fecIni); HttpContext.Session["rptSource"] = ModeloInventarioPlanilla.ListInventarioPlanilla; var _estado = (ModeloInventarioPlanilla == null) ? "0" : "1"; if (ModeloInventarioPlanilla != null) { if (ModeloInventarioPlanilla.ListInventarioPlanilla.Count == 0) { _estado = "-1"; //ViewBag.Tienda = ec.get_ListaTienda(); } } return(Json(new { estado = _estado })); } catch (Exception ex) { ex.Message.ToString(); throw; } }