Пример #1
0
        private string salida(HttpContext context)
        {
            string         response   = string.Empty;
            string         referencia = string.Empty;
            string         option     = context.Request["opt"].ToString();
            Salida_aud_uni oSalAudUni;
            string         path         = string.Empty;
            string         TemplatePath = string.Empty;

            try
            {
                switch (option)
                {
                case "getOrdenCargaByFolio":
                    jsonData   = new StreamReader(context.Request.InputStream).ReadToEnd();
                    referencia = jsonData.ToString();
                    response   = JsonConvert.SerializeObject(SalidaCtrl.OrdenCargaGetByFolio(referencia));
                    break;

                case "AudUniAdd":
                    jsonData   = new StreamReader(context.Request.InputStream).ReadToEnd();
                    oSalAudUni = JsonConvert.DeserializeObject <Salida_aud_uni>(jsonData);
                    if (oSalAudUni.PLstSalAudUniFiles == null)
                    {
                        oSalAudUni.PLstSalAudUniFiles = new List <Salida_aud_uni_files>();
                    }
                    path         = Path.Combine(HttpContext.Current.Server.MapPath("~/rpt/salidas_aud/"), oSalAudUni.Referencia + @"\");
                    TemplatePath = HttpContext.Current.Server.MapPath("~/report/Formatos/casc028.rpt");
                    SalidaCtrl.SalidaAudUniAdd(oSalAudUni, path);
                    dsForm = new dsFormatos();
                    DocFormatos.getCasc028(Path.Combine(path, oSalAudUni.prefixImg + "casc028.pdf"), TemplatePath, SalidaCtrl.SalidaAudUniGetAll(oSalAudUni), dsForm);
                    response = JsonConvert.SerializeObject(oSalAudUni);
                    break;

                default:
                    throw new Exception("La opción " + option + " no existe");
                }
            }
            catch
            {
                throw;
            }
            return(response);
        }
Пример #2
0
        private void printItextSharp()
        {
            string     path             = string.Empty;
            string     pathImg          = string.Empty;
            string     virtualPath      = string.Empty;
            string     rpt              = string.Empty;
            string     RptFileName      = string.Empty;
            string     TemplatePath     = string.Empty;
            string     TemplatePathCond = string.Empty;
            string     key;
            object     obj;
            dsFormatos ds = new dsFormatos();

            try
            {
                rpt = Request["rpt"].ToString();

                switch (rpt)
                {
                case "entrada":
                    obj         = (Entrada)Session["SEntrada"];
                    RptFileName = ((Entrada)obj).Folio + ((Entrada)obj).Folio_indice + ".pdf";
                    path        = HttpContext.Current.Server.MapPath("~/rpt/entradas/") + RptFileName;

                    switch (((Entrada)obj).Id_cliente)
                    {
                    case 1:
                    case 9:
                    case 11:
                    case 12:
                    case 13:
                    case 14:
                    case 15:
                    case 25:
                    case 30:
                    case 32:
                        TemplatePath = HttpContext.Current.Server.MapPath("~/report/Formatos/entrada.rpt");
                        DocEntrada.getEntrada(path, TemplatePath, (Entrada)obj, ds);
                        break;

                    default:
                        pathImg      = HttpContext.Current.Server.MapPath("~/images/logo.jpg");
                        TemplatePath = HttpContext.Current.Server.MapPath("~/rpt/TemplateEntrada.pdf");
                        DocEntrada.getEntrada(path, TemplatePath, (Entrada)obj);
                        break;
                    }

                    //obj = (Entrada)Session["SEntrada"];
                    //RptFileName = ((Entrada)obj).Folio + ((Entrada)obj).Folio_indice + ".pdf";
                    //path = HttpContext.Current.Server.MapPath("~/rpt/entradas/") + RptFileName;
                    //pathImg = HttpContext.Current.Server.MapPath("~/images/logo.jpg");
                    //TemplatePath = HttpContext.Current.Server.MapPath("~/rpt/TemplateEntrada.pdf");
                    //DocEntrada.getEntrada(path, TemplatePath, (Entrada)obj);
                    //ShowPdf(path);
                    //HTMLToPdf(getHtmlPdf(((Entrada)obj)), path);

                    ShowPdf(path);

                    break;

                case "salida":
                    obj         = (Salida)Session["SSalida"];
                    RptFileName = ((Salida)obj).Folio + ((Salida)obj).Folio_indice + ".pdf";
                    path        = HttpContext.Current.Server.MapPath("~/rpt/salidas/") + RptFileName;

                    switch (((Salida)obj).Id_cliente)
                    {
                    case 1:
                    case 9:
                    case 11:
                    case 12:
                    case 13:
                    case 14:
                    case 15:
                    case 25:
                    case 30:
                    case 32:
                        TemplatePath = HttpContext.Current.Server.MapPath("~/report/Formatos/salida.rpt");
                        DocSalida.getSalida(path, TemplatePath, (Salida)obj, ds);
                        break;

                    default:
                        pathImg      = HttpContext.Current.Server.MapPath("~/images/logo.jpg");
                        TemplatePath = HttpContext.Current.Server.MapPath("~/rpt/TemplateSalida.pdf");
                        DocSalida.getSalida(path, TemplatePath, (Salida)obj);
                        break;
                    }


                    ShowPdf(path);
                    break;

                case "remision":
                    obj          = (Salida_remision)Session["SSalida_remision"];
                    RptFileName  = ((Salida_remision)obj).Folio_remision + ".pdf";
                    path         = HttpContext.Current.Server.MapPath("~/rpt/remisiones/") + RptFileName;
                    pathImg      = HttpContext.Current.Server.MapPath("~/images/logo.jpg");
                    TemplatePath = HttpContext.Current.Server.MapPath("~/rpt/TemplateRemision.pdf");
                    DocRemision.getRemision(path, TemplatePath, (Salida_remision)obj);
                    ShowPdf(path);
                    break;

                case "ordcarga":
                    //obj = (Salida_orden_carga)Session["SSalida_ord_carga"];
                    obj          = SalidaCtrl.OrdenCargaGetById(Convert.ToInt32(Request["id"].ToString()), false);
                    RptFileName  = ((Salida_orden_carga)obj).Folio_orden_carga + ".pdf";
                    path         = HttpContext.Current.Server.MapPath("~/rpt/ordencarga/") + RptFileName;
                    pathImg      = HttpContext.Current.Server.MapPath("~/images/logo.jpg");
                    TemplatePath = HttpContext.Current.Server.MapPath("~/rpt/TemplateOrdenCarga.pdf");
                    DocOrdenCarga.getOrdenCarga(path, TemplatePath, (Salida_orden_carga)obj);
                    ShowPdf(path);
                    break;

                case "ordCargaSal":
                    obj              = SalidaCtrl.OrdenCargaGetById(Convert.ToInt32(((Usuario)Session["userCasc"]).Id_print), false);
                    RptFileName      = ((Salida_orden_carga)obj).Folio_orden_carga + "_S.pdf";
                    path             = HttpContext.Current.Server.MapPath("~/rpt/ordencarga/") + RptFileName;
                    TemplatePath     = HttpContext.Current.Server.MapPath("~/report/Formatos/salida.rpt");
                    TemplatePathCond = HttpContext.Current.Server.MapPath("~/report/Formatos/auduniemb.rpt");
                    DocSalida.getSalidaOC(path, new string[] { TemplatePath, TemplatePathCond }, (Salida_orden_carga)obj, ds);
                    ShowPdf(path);
                    break;

                case "rptAlmRes":
                    int anio = Convert.ToInt32(Request["anio"]);
                    int mes  = Convert.ToInt32(Request["mes"]);
                    RptFileName  = "Resumen_" + anio.ToString() + "_" + mes.ToString() + ".pdf";
                    TemplatePath = HttpContext.Current.Server.MapPath("~/rpt/TemplateResAlm.pdf");
                    path         = HttpContext.Current.Server.MapPath("~/rpt/rptAlm/") + RptFileName;
                    DocAlmacenResumen.getAlmResumen(path, TemplatePath, anio, mes);
                    ShowPdf(path);
                    break;

                case "ordCargaSalTra":
                    obj = SalidaCtrl.OrdenCargaGetById(Convert.ToInt32(((Usuario)Session["userCasc"]).Id_print), false);
                    ((Salida_orden_carga)obj).LstSalida = ((Salida_orden_carga)Session["SSalida_ord_carga"]).LstSalida;
                    foreach (Salida_orden_carga_tc itemTC in ((Salida_orden_carga)obj).PLstSalOCTransCond)
                    {
                        itemTC.Si_no = ((Salida_orden_carga)Session["SSalida_ord_carga"]).PLstSalOCTransCond.Find(p => p.Id_transporte_condicion == itemTC.Id_transporte_condicion).Si_no;
                    }
                    RptFileName      = ((Salida_orden_carga)obj).Folio_orden_carga + "_S.pdf";
                    path             = HttpContext.Current.Server.MapPath("~/rpt/ordencarga/") + RptFileName;
                    TemplatePathCond = HttpContext.Current.Server.MapPath("~/report/Formatos/auduniemb.rpt");
                    DocSalida.getSalidaOCTransCondicion(path, TemplatePathCond, (Salida_orden_carga)obj, ((Salida_orden_carga)obj).LstSalida.First(), ds);
                    Session.Remove("SSalida_ord_carga");
                    ShowPdf(path);
                    break;

                case "maqpso":
                    obj          = (Orden_trabajo_servicio)Session["SOrdTbjSer"];
                    RptFileName  = ((Orden_trabajo_servicio)obj).Ref1 + ".pdf";
                    path         = HttpContext.Current.Server.MapPath("~/rpt/maqpas/") + RptFileName;
                    TemplatePath = HttpContext.Current.Server.MapPath("~/report/Formatos/maqpso.rpt");
                    DocOdnTbj.getOdnTbjSrv(path, TemplatePath, (Orden_trabajo_servicio)obj, ds);
                    //DocEntrada.getEntrada(path, TemplatePath, (Entrada)obj, ds);
                    Session.Remove("SOrdTbjSer");
                    ShowPdf(path);
                    break;

                case "SalAud":
                    key = Request["_key"].ToString();
                    Salida_transporte_auditoria sTA = SalidaCtrl.SalidaTransporteAuditoriaGet(Convert.ToInt32(key));
                    RptFileName  = sTA.Folio + ".pdf";
                    path         = HttpContext.Current.Server.MapPath("~/rpt/salaudtrans/") + RptFileName;
                    TemplatePath = HttpContext.Current.Server.MapPath("~/report/Formatos/auduniemb.rpt");
                    DocSalida.getSalidaAudUni(path, TemplatePath, sTA, ds);
                    ShowPdf(path);
                    break;

                default:
                    break;
                }
            }
            catch
            {
                throw;
            }
        }
Пример #3
0
        private string entrada(HttpContext context)
        {
            string          response   = string.Empty;
            string          referencia = string.Empty;
            string          option     = context.Request["opt"].ToString();
            Entrada_aud_uni oEntAudUni;
            Entrada_aud_mer oEntAudMer;
            string          path         = string.Empty;
            string          TemplatePath = string.Empty;

            //string referencia = context.Request["referencia"].ToString();
            try
            {
                switch (option)
                {
                case "precargaGetByRef":
                    jsonData   = new StreamReader(context.Request.InputStream).ReadToEnd();
                    referencia = jsonData.ToString();
                    response   = JsonConvert.SerializeObject(EntradaCtrl.EntradaPreCargaGetByRef(referencia));
                    break;

                case "AudUniAdd":
                    jsonData   = new StreamReader(context.Request.InputStream).ReadToEnd();
                    oEntAudUni = JsonConvert.DeserializeObject <Entrada_aud_uni>(jsonData);
                    if (oEntAudUni.PLstEntAudUniFiles == null)
                    {
                        oEntAudUni.PLstEntAudUniFiles = new List <Entrada_aud_uni_files>();
                    }
                    path         = Path.Combine(HttpContext.Current.Server.MapPath("~/rpt/entradas_aud/"), oEntAudUni.Referencia + @"\");
                    TemplatePath = HttpContext.Current.Server.MapPath("~/report/Formatos/casc028.rpt");
                    EntradaCtrl.EntradaAudUniAdd(oEntAudUni, path);
                    dsForm = new dsFormatos();
                    DocFormatos.getCasc028(Path.Combine(path, oEntAudUni.prefixImg + "casc028.pdf"), TemplatePath, EntradaCtrl.EntradaPreCargaGetAllById(oEntAudUni), dsForm);
                    response = JsonConvert.SerializeObject(oEntAudUni);
                    break;

                case "AudMerAdd":
                    jsonData   = new StreamReader(context.Request.InputStream).ReadToEnd();
                    oEntAudMer = JsonConvert.DeserializeObject <Entrada_aud_mer>(jsonData);
                    if (oEntAudMer.PLstEntAudMerFiles == null)
                    {
                        oEntAudMer.PLstEntAudMerFiles = new List <Entrada_aud_mer_files>();
                    }
                    path         = Path.Combine(HttpContext.Current.Server.MapPath("~/rpt/entradas_aud/"), oEntAudMer.Referencia + @"\");
                    TemplatePath = HttpContext.Current.Server.MapPath("~/report/Formatos/casc028.rpt");
                    EntradaCtrl.EntradaAudMerAdd(oEntAudMer, path);
                    dsForm = new dsFormatos();
                    DocFormatos.getCasc028(Path.Combine(path, oEntAudMer.prefixImg + "casc028.pdf"), TemplatePath, EntradaCtrl.EntradaPreCargaGetAllById(oEntAudMer), dsForm);
                    response = JsonConvert.SerializeObject(oEntAudMer);
                    break;

                default:
                    throw new Exception("La opción " + option + " no existe");
                }
            }
            catch
            {
                throw;
            }
            return(response);
        }