示例#1
0
    private MemoryStream PrintHaulierSub(string orderNo, string jobType, string haulierCode)
    {
        XtraReport rpt = new XtraReport();

        rpt.LoadLayout(Server.MapPath(@"~\PagesContTrucking\Report\repx\HaulierTruckingAdviceSub.repx"));
        rpt.DataSource = DocPrint.PrintHaulierSub(orderNo, jobType, haulierCode);


        QR q = new QR();

        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.CtmJob), "JobNo='" + orderNo + "'");
        C2.CtmJob job  = C2.Manager.ORManager.GetObject(query) as C2.CtmJob;
        string    text = string.Format(@"JobNo:" + orderNo + ",JobDate:" + job.JobDate.ToString("dd/MM/yyyy"));
        Bitmap    bt   = q.Create_QR(text);
        string    path = MapPath("~/files/barcode/");

        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }
        string fileName = orderNo + ".png";
        string filePath = path + fileName;

        if (File.Exists(filePath))
        {
            File.Delete(filePath);
        }
        bt.Save(Server.MapPath("~/files/barcode/") + fileName);
        DevExpress.XtraReports.UI.XRPictureBox qr_code = rpt.Report.FindControl("barcode", true) as DevExpress.XtraReports.UI.XRPictureBox;
        if (qr_code != null)
        {
            qr_code.ImageUrl = "/files/barcode/" + fileName;
        }

        System.IO.MemoryStream str = new MemoryStream();
        rpt.ExportToPdf(str);
        return(str);
    }
示例#2
0
    private void set_signed_barcode_byid(XtraReport rpt, string orderNo, string id, string httpPath, string filename)
    {
        QR q = new QR();

        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.CtmJobDet2), "Id=" + id + "");
        C2.CtmJobDet2 job = C2.Manager.ORManager.GetObject(query) as C2.CtmJobDet2;
        //string text = string.Format(@"JobNo:" + orderNo);

        Bitmap bt   = q.Create_QR(httpPath);
        string path = MapPath("~/files/barcode/");

        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }
        string fileName = id + ".png";
        string filePath = path + fileName;

        if (File.Exists(filePath))
        {
            File.Delete(filePath);
        }
        bt.Save(Server.MapPath("~/files/barcode/") + fileName);

        DevExpress.XtraReports.UI.XRPictureBox qr_code = rpt.Report.FindControl("barcode", true) as DevExpress.XtraReports.UI.XRPictureBox;
        if (qr_code != null)
        {
            qr_code.ImageUrl = "/files/barcode/" + fileName;
        }

        string Signature_Consignee = "";
        string Signature_Driver    = "";
        string signature_time      = "";
        string signature_time1     = "";

        string sql_signature = string.Format(@"select Id,FileType,FileName,FilePath,FileNote,CreateDateTime From CTM_Attachment where FileType='Signature' and RefNo=@RefNo and charindex(@sType, FileNote,0)>0 and TripId=@tripId");
        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@RefNo", orderNo, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@sType", "Consignee", SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@tripId", id, SqlDbType.Int));
        DataTable dt = ConnectSql_mb.GetDataTable(sql_signature, list);

        if (dt.Rows.Count > 0)
        {
            if (job.EpodHardCopy == "HardCopy")
            {
                Signature_Consignee = dt.Rows[0]["FilePath"].ToString().Replace(@"/500", "");
            }
            else
            {
                Signature_Consignee = dt.Rows[0]["FilePath"].ToString();
            }
            signature_time = dt.Rows[0]["CreateDateTime"].ToString();
        }
        list = new List <ConnectSql_mb.cmdParameters>();
        list.Add(new ConnectSql_mb.cmdParameters("@RefNo", orderNo, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@sType", "Driver", SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@tripId", id, SqlDbType.Int));
        dt = ConnectSql_mb.GetDataTable(sql_signature, list);
        if (dt.Rows.Count > 0)
        {
            Signature_Driver = dt.Rows[0]["FilePath"].ToString();
            signature_time1  = dt.Rows[0]["CreateDateTime"].ToString();
        }
        DevExpress.XtraReports.UI.XRPictureBox signature = rpt.Report.FindControl("signature", true) as DevExpress.XtraReports.UI.XRPictureBox;
        if (signature != null)
        {
            signature.ImageUrl = Signature_Consignee;
        }
        DevExpress.XtraReports.UI.XRLabel time = rpt.Report.FindControl("lbl_time", true) as DevExpress.XtraReports.UI.XRLabel;
        if (time != null)
        {
            time.Text = signature_time;
        }
        DevExpress.XtraReports.UI.XRPictureBox signature1 = rpt.Report.FindControl("signature1", true) as DevExpress.XtraReports.UI.XRPictureBox;
        if (signature1 != null)
        {
            signature1.ImageUrl = Signature_Driver;
        }
        DevExpress.XtraReports.UI.XRLabel time1 = rpt.Report.FindControl("lbl_time1", true) as DevExpress.XtraReports.UI.XRLabel;
        if (time1 != null)
        {
            time1.Text = signature_time1;
        }
    }
示例#3
0
    private MemoryStream PrintDelivery(string orderNo, string jobType)
    {
        XtraReport rpt = new XtraReport();

        rpt.LoadLayout(Server.MapPath(@"~\PagesContTrucking\Report\repx\DeliveryOrder.repx"));
        rpt.DataSource = DocPrint.PrintHaulier(orderNo, jobType);


        QR q = new QR();

        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.CtmJob), "JobNo='" + orderNo + "'");
        C2.CtmJob job  = C2.Manager.ORManager.GetObject(query) as C2.CtmJob;
        string    text = string.Format(@"JobNo:" + orderNo + ",JobDate:" + job.JobDate.ToString("dd/MM/yyyy"));
        Bitmap    bt   = q.Create_QR(text);
        string    path = MapPath("~/files/barcode/");

        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }
        string fileName = orderNo + ".png";
        string filePath = path + fileName;

        if (File.Exists(filePath))
        {
            File.Delete(filePath);
        }
        bt.Save(Server.MapPath("~/files/barcode/") + fileName);
        DevExpress.XtraReports.UI.XRPictureBox qr_code = rpt.Report.FindControl("barcode", true) as DevExpress.XtraReports.UI.XRPictureBox;
        if (qr_code != null)
        {
            qr_code.ImageUrl = "/files/barcode/" + fileName;
        }
        string sql_trip = string.Format(@"select top 1 Id from ctm_jobdet2 where JobNo='{0}'", orderNo);

        string tripId = ConnectSql_mb.ExecuteScalar(sql_trip);

        string Signature_Consignee = "";
        string Signature_Driver    = "";

        string sql_signature = string.Format(@"select Id,FileType,FileName,FilePath,FileNote From CTM_Attachment where FileType='Signature' and RefNo=@RefNo and charindex(@sType, FileNote,0)>0 and TripId=@tripId");
        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@RefNo", orderNo, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@sType", "Consignee", SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@tripId", tripId, SqlDbType.Int));
        DataTable dt = ConnectSql_mb.GetDataTable(sql_signature, list);

        if (dt.Rows.Count > 0)
        {
            Signature_Consignee = dt.Rows[0]["FilePath"].ToString();
        }
        list = new List <ConnectSql_mb.cmdParameters>();
        list.Add(new ConnectSql_mb.cmdParameters("@RefNo", orderNo, SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@sType", "Driver", SqlDbType.NVarChar, 100));
        list.Add(new ConnectSql_mb.cmdParameters("@tripId", tripId, SqlDbType.Int));
        dt = ConnectSql_mb.GetDataTable(sql_signature, list);
        if (dt.Rows.Count > 0)
        {
            Signature_Driver = dt.Rows[0]["FilePath"].ToString();
        }


        DevExpress.XtraReports.UI.XRPictureBox signature = rpt.Report.FindControl("signature", true) as DevExpress.XtraReports.UI.XRPictureBox;
        if (signature != null)
        {
            signature.ImageUrl = Signature_Consignee;
        }
        DevExpress.XtraReports.UI.XRPictureBox signature1 = rpt.Report.FindControl("signature1", true) as DevExpress.XtraReports.UI.XRPictureBox;
        if (signature1 != null)
        {
            signature1.ImageUrl = Signature_Driver;
        }
        System.IO.MemoryStream str = new MemoryStream();
        rpt.ExportToPdf(str);
        return(str);
    }
示例#4
0
    private bool ePOD_SendEmail(int tripId)
    {
        bool   res = false;
        string sql = string.Format(@"select job.JobNo,job.EmailAddress,job.JobType,det2.epodHardCopy  
from ctm_jobdet2 as det2
left outer join ctm_job as job on job.JobNo=det2.JobNo
where det2.Id=@tripId");
        List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>();

        list.Add(new ConnectSql_mb.cmdParameters("@tripId", tripId, SqlDbType.Int));
        DataTable dt = ConnectSql_mb.GetDataTable(sql, list);

        if (dt.Rows.Count > 0)
        {
            string JobNo    = dt.Rows[0]["JobNo"].ToString();
            string email    = dt.Rows[0]["EmailAddress"].ToString();
            string JobType  = dt.Rows[0]["JobType"].ToString();
            string hardCopy = dt.Rows[0]["epodHardCopy"].ToString();

            if (email != "")
            {
                try
                {
                    //bool action = false;
                    string path1 = string.Format("~/files/pdf/");
                    string path2 = path1.Replace(' ', '_').Replace('\'', '_');
                    string pathx = path2.Substring(1);
                    //string path3 = MapPath(path2);
                    //string path3 = Path.Combine(@"C:\boox\boox_ell", path2);
                    string path3 = HttpContext.Current.Server.MapPath(path2);
                    if (!Directory.Exists(path3))
                    {
                        Directory.CreateDirectory(path3);
                    }
                    string p      = string.Format(@"~\files\pdf\DeliveryOrder_Crane_{0}.pdf", DateTime.Now.ToString("yyyyMMdd_HHmmss"));
                    string e_file = HttpContext.Current.Server.MapPath(p);
                    //if (!File.Exists(e_file))
                    //{
                    //    File.Create(e_file);
                    //}

                    MemoryStream ms  = new MemoryStream();
                    XtraReport   rpt = new XtraReport();
                    if (hardCopy == "HardCopy")
                    {
                        rpt.LoadLayout(Server.MapPath(@"~\PagesContTrucking\Report\repx\DO_HardCopy.repx"));
                    }
                    else
                    {
                        rpt.LoadLayout(Server.MapPath(@"~\PagesContTrucking\Report\repx\DeliveryOrder_CRA.repx"));
                    }
                    rpt.DataSource = DocPrint.PrintJobSheet(JobNo, JobType, tripId + "");


                    //============ bind signatrue
                    QR q = new QR();
                    Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.CtmJob), "JobNo='" + JobNo + "'");
                    C2.CtmJob job  = C2.Manager.ORManager.GetObject(query) as C2.CtmJob;
                    string    text = string.Format(@"JobNo:" + JobNo + ",JobDate:" + job.JobDate.ToString("dd/MM/yyyy"));
                    Bitmap    bt   = q.Create_QR(text);
                    string    path = HttpContext.Current.Server.MapPath("~/files/barcode/");
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    string fileName = JobNo + ".png";
                    string filePath = path + fileName;
                    if (File.Exists(filePath))
                    {
                        File.Delete(filePath);
                    }
                    bt.Save(Server.MapPath("~/files/barcode/") + fileName);

                    string Signature_Consignee = "";
                    string Signature_Driver    = "";
                    string sql_signature       = string.Format(@"select Id,FileType,FileName,FilePath,FileNote From CTM_Attachment where FileType='Signature' and RefNo=@RefNo and charindex(@sType, FileNote,0)>0 and TripId=@tripId");
                    list = new List <ConnectSql_mb.cmdParameters>();
                    list.Add(new ConnectSql_mb.cmdParameters("@RefNo", JobNo, SqlDbType.NVarChar, 100));
                    list.Add(new ConnectSql_mb.cmdParameters("@sType", "Consignee", SqlDbType.NVarChar, 100));
                    list.Add(new ConnectSql_mb.cmdParameters("@tripId", tripId, SqlDbType.Int));
                    dt = ConnectSql_mb.GetDataTable(sql_signature, list);
                    if (dt.Rows.Count > 0)
                    {
                        Signature_Consignee = dt.Rows[0]["FilePath"].ToString().Replace(@"/500", "");
                    }
                    list = new List <ConnectSql_mb.cmdParameters>();
                    list.Add(new ConnectSql_mb.cmdParameters("@RefNo", JobNo, SqlDbType.NVarChar, 100));
                    list.Add(new ConnectSql_mb.cmdParameters("@sType", "Driver", SqlDbType.NVarChar, 100));
                    list.Add(new ConnectSql_mb.cmdParameters("@tripId", tripId, SqlDbType.Int));
                    dt = ConnectSql_mb.GetDataTable(sql_signature, list);
                    if (dt.Rows.Count > 0)
                    {
                        Signature_Driver = dt.Rows[0]["FilePath"].ToString();
                    }
                    DevExpress.XtraReports.UI.XRPictureBox qr_code = rpt.Report.FindControl("barcode", true) as DevExpress.XtraReports.UI.XRPictureBox;
                    if (qr_code != null)
                    {
                        qr_code.ImageUrl = "/files/barcode/" + fileName;
                    }
                    DevExpress.XtraReports.UI.XRPictureBox signature = rpt.Report.FindControl("signature", true) as DevExpress.XtraReports.UI.XRPictureBox;
                    if (signature != null)
                    {
                        signature.ImageUrl = Signature_Consignee;
                    }
                    signature = rpt.Report.FindControl("signature1", true) as DevExpress.XtraReports.UI.XRPictureBox;
                    if (signature != null)
                    {
                        signature.ImageUrl = Signature_Driver;
                    }



                    System.IO.MemoryStream str = new MemoryStream();
                    rpt.CreateDocument();
                    rpt.ExportToPdf(e_file);


                    Helper.Email.SendEmail(email, "*****@*****.**", "*****@*****.**", "Delivery Order " + JobNo, "", p);

                    res = true;
                }
                catch { }

                //            string company = System.Configuration.ConfigurationManager.AppSettings["CompanyName"];
                //            string address1 = System.Configuration.ConfigurationManager.AppSettings["CompanyAddress1"];
                //            string address2 = System.Configuration.ConfigurationManager.AppSettings["CompanyAddress2"];
                //            string address3 = System.Configuration.ConfigurationManager.AppSettings["CompanyAddress3"];
                //            sql = string.Format(@"select Email1,Email2,Name from xxparty where PartyId='{0}'",JobNo);
                //            DataTable tab = ConnectSql.GetTab(sql);
                //            string add = address1 + " " + address2 + " " + address3;
                //            string title = "Haulier Advice";
                //            if (tab.Rows.Count > 0)
                //            {
                //                string email1 = SafeValue.SafeString(tab.Rows[0]["Email1"]);
                //                string email2 = SafeValue.SafeString(tab.Rows[0]["Email2"]);
                //                string name = SafeValue.SafeString(tab.Rows[0]["Name"]);
                //                string mes = string.Format(@"<b>{0}</b><br><br>
                //{1}<br><br>
                //<b>Dear Customer, <br><br>Kindly review attached document for  HAULIER ADVICE.</b>
                //<br><br>
                //<b>This is a computer generated email, please DO NOT reply.
                //<br><br>
                //Pls email to : [email protected] for any questions.
                //</b><br><br>
                //***IMPORTANT NOTICE***<br><br>
                //
                //1.     Pls wait for our delivery department to call you for delivery arrangement<br><br>
                //
                //2.     Delivery arrangement will be made within 3 working days from the date of unstuffing of container.<br><br>
                //<br><br>", company, add);
                //                if (email1.Length > 0)
                //                {
                //                    Helper.Email.SendEmail(email1, "[email protected],[email protected]", "*****@*****.**", title, mes, p);
                //                    //Helper.Email.SendEmail("*****@*****.**", "[email protected],[email protected]", "", title, mes, p);
                //                    action = true;
                //                }
                //                if (email2.Length > 0)
                //                {
                //                    if (action)
                //                        Helper.Email.SendEmail(email2, "", "", title, mes, p);
                //                    else
                //                        Helper.Email.SendEmail(email2, "[email protected],[email protected]", "*****@*****.**", title, mes, p);
                //                }
                //                //"*****@*****.**", "*****@*****.**"
                //                res = true;
                //            }
            }
        }
        return(res);
    }