Esempio n. 1
0
        public ActionResult PrintLTO(string tCOI, string LTOType, string PrefixLTO)
        {
            var ListLTO = (from chrgd in db.T_BILLCHRGD
                           from mpaip in db.M_PAIP
                           from chrgh in db.T_BILLCHRGH
                           where chrgd.BCHCHRGNO == chrgh.BCHCHRGNO
                           && mpaip.PAPIN == chrgh.PAPIN
                           && chrgd.COLORNUM != null
                           && chrgd.COI == tCOI
                           && mpaip.NON_LTO == LTOType
                           select new
                           { chrgh.BCHDTE,
                           mpaip.PALNAME,
                           mpaip.FIRST_NAME,
                           mpaip.MIDDLE_NAME,
                           mpaip.COMPANY_NAME,
                           mpaip.BY_COMPNAME,
                           chrgd.BCDPATCOVER,
                           chrgd.BCDSERIES,
                           chrgd.SUM_INSIRED,
                           chrgd.BCDTPPCOVER,
                           chrgd.BCHCHRGNO,
                           mpaip.MODEL_YR,
                           chrgd.COI,
                           chrgd.AUTHEN_CODE,
                           chrgd.BCDSINO,
                           mpaip.PAADDRESS,
                           mpaip.PLATE_NO,
                           mpaip.NON_LTO,
                           mpaip.MAKE,
                           mpaip.SERIAL_NO,
                           mpaip.COLOR,
                           mpaip.UN_WEIGHT,
                           mpaip.COMP_ID,
                           chrgd.INCEPTION_FROM,
                           chrgd.INCEPTION_TO,
                           mpaip.MOTOR_NO,
                           chrgd.COLORNUM,
                           mpaip.SERVICE_TYPE,
                           mpaip.SEATING_CAPACITY,
                           mpaip.MV_FILENO,
                           chrgd.PRNT,
                           chrgd.DATE_PRINTED,
                           chrgd.COC_SERIES}).FirstOrDefault();

            var listR_SGSI = (from sgseries in db.R_SGSI
                              where sgseries.PREFIX == PrefixLTO
                              select sgseries).FirstOrDefault();

            var m_CompID = (from compid in db.M_COMPANY
                                     select compid.COMP_ID).FirstOrDefault();

            decimal currentSERIES = Convert.ToDecimal(listR_SGSI.SGSERIES) + 1;
            var prefix = listR_SGSI.PREFIX;

            var PolicyNo = prefix + currentSERIES.ToString("0000000");
            var CertOfCover = m_CompID + currentSERIES.ToString("0000000");

            LTO oLTO = new LTO();
            oLTO.AUTHENCODE = ListLTO.AUTHEN_CODE;
            oLTO.BCDPATCOVER = Convert.ToDecimal(ListLTO.BCDPATCOVER);
            oLTO.BCDSERIES = ListLTO.BCDSERIES;
            oLTO.BCDSINO = ListLTO.BCDSINO;
            oLTO.BCDTPPCOVER = Convert.ToDecimal(ListLTO.BCDTPPCOVER);
            oLTO.BCHCHRGNO = ListLTO.BCHCHRGNO;
            oLTO.BCHDTE = Convert.ToDateTime(ListLTO.BCHDTE);
            oLTO.ByCOMPNAME = ListLTO.BY_COMPNAME.ToString();

            //Incremented COC
            oLTO.COCSERIES = CertOfCover;
            oLTO.COI = PolicyNo;

            //sdkjhaskdhaskjhdkasj
            oLTO.COLOR = ListLTO.COLOR;
            oLTO.COLORNUM = ListLTO.COLORNUM;
            oLTO.CompanyName = ListLTO.COMPANY_NAME;
            oLTO.COMPID = ListLTO.COMP_ID;
            oLTO.DATEPRINTED = Convert.ToDateTime(ListLTO.DATE_PRINTED);
            oLTO.FirstName = ListLTO.FIRST_NAME;
            oLTO.INCEPTIONFROM = Convert.ToDateTime(ListLTO.INCEPTION_FROM);
            oLTO.INCEPTIONTO = Convert.ToDateTime(ListLTO.INCEPTION_TO);
            oLTO.MAKE = ListLTO.MAKE;
            oLTO.MiddleName = ListLTO.MIDDLE_NAME;
            oLTO.MODELYR = ListLTO.MODEL_YR;
            oLTO.MOTORNO = ListLTO.MOTOR_NO;
            oLTO.MVFILENO = ListLTO.MV_FILENO;
            oLTO.NONLTO = ListLTO.NON_LTO.ToString();
            oLTO.PAADDRESS = ListLTO.PAADDRESS;
            oLTO.PALNAME = ListLTO.PALNAME;
            oLTO.PLATENO = ListLTO.PLATE_NO;
            oLTO.PRNT = ListLTO.PRNT;
            oLTO.SEATINGCAPACITY = ListLTO.SEATING_CAPACITY;
            oLTO.SERIALNO = ListLTO.SERIAL_NO;

            //Add to encryption string
            notEncrypted = "PAT COVER: " + oLTO.BCDPATCOVER + " PLATE: " + oLTO.PLATENO + " AUTHENTICATION CODE: " + oLTO.AUTHENCODE ;

            if (ListLTO.SERVICE_TYPE == null)
            {
                oLTO.SERVICETYPE = "";
            }
            else
            {
                oLTO.SERVICETYPE = ListLTO.SERVICE_TYPE;
            }

            oLTO.SUMINSIRED = Convert.ToDecimal(ListLTO.SUM_INSIRED);
            oLTO.UNWEIGHT = ListLTO.UN_WEIGHT;

            //Missing encryption for reference

            //Increments and updates SGSERIES

            //return View();

            //updateSGSERIES(PrefixLTO);
            return generateLTORPT(oLTO, LTOType);
        }
Esempio n. 2
0
        public ActionResult generateLTORPT(LTO listLTOObject, string ltoTypeParam)
        {
            List<LTO> ltoList = new List<LTO>();
            ltoList.Add(listLTOObject);

            var path = "";

            switch (ltoTypeParam)
            {
                case "0":
                    path = crpathLTO;
                    break;
                case "1":
                    path = crpathNONLTO;
                    break;
                default:
                    break;
            }

            if (ltoTypeParam == "0")
            {
                RptLTO rptH = new RptLTO();
                rptH.FileName = Server.MapPath(path);
                rptH.Load();
                rptH.SetDataSource(ltoList);
                rptH.SetParameterValue("encodedField", generateEncodedField());
                Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                return File(stream, "application/pdf");
            }
            else if (ltoTypeParam == "1")
            {
                RptNonLTO rptNON = new RptNonLTO();
                rptNON.FileName = Server.MapPath(path);
                rptNON.Load();
                rptNON.SetDataSource(ltoList);
                rptNON.SetParameterValue("encodedField", generateEncodedField());
                Stream stream = rptNON.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                return File(stream, "application/pdf");
            }
            else
            {
                return null;
            }
        }