예제 #1
0
        public static ReportHeader getReportHeder(job_sample _sample)
        {
            ReportHeader rpt = new ReportHeader();

            job_info _job = new job_info();

            _job = _job.SelectByID(_sample.job_id);
            if (_job != null)
            {
                m_customer _cus = new m_customer();
                _cus = _cus.SelectByID(_job.customer_id);

                m_customer_address addr = new m_customer_address();
                addr = addr.SelectByID(_job.customer_address_id.Value);

                if (_cus != null)
                {
                    rpt.addr1 = _cus.company_name;
                    rpt.addr2 = addr.address;
                }
                rpt.cusRefNo = _job.customer_ref_no;// (_sample.sample_po== null) ? String.Empty : _sample.sample_po.ToString();
                rpt.cur_date = DateTime.Now;

                rpt.dateOfDampleRecieve = Convert.ToDateTime(_job.date_of_receive);
                rpt.dateOfAnalyze       = Convert.ToDateTime(_sample.date_chemist_alalyze);
                rpt.dateOfTestComplete  = Convert.ToDateTime(_sample.date_chemist_complete);

                //ATT / ELP / 16 / XXXX(เลขจ็อบ) - XX(Test)

                int phisicalYear = Convert.ToInt16(DateTime.Now.Year.ToString().Substring(2));
                if (DateTime.Now.Month < 4)
                {
                    phisicalYear = Convert.ToInt16(DateTime.Now.Year.ToString().Substring(2)) - 1;
                }

                String AmRetest = String.Empty;
                switch (_sample.amend_or_retest)
                {
                case "AM":
                    AmRetest = (_sample.amend_count > 0) ? "AM" + _sample.amend_count + "/" : String.Empty;
                    break;

                case "R":
                    AmRetest = (_sample.retest_count > 0) ? "R" + _sample.retest_count + "/" : String.Empty;
                    break;
                }

                String[] tmp = _sample.job_number.Split('-');
                rpt.alsRefNo    = String.Format("{0}ATT/{1}/{2}/{3}-{4}", AmRetest, tmp[0], phisicalYear, tmp[1], tmp[2]);// _sample.job_number.ToString();
                rpt.description = (String.IsNullOrEmpty(_sample.description) ? String.Empty : "Description:" + _sample.description + "\n") +
                                  (String.IsNullOrEmpty(_sample.model) ? String.Empty : "Model:" + _sample.model + "\n") +
                                  (String.IsNullOrEmpty(_sample.surface_area) ? String.Empty : "Surface Area:" + _sample.surface_area + "\n") +
                                  (!String.IsNullOrEmpty(_sample.remarks) ? "Remark: " + _sample.remarks + "\n" : "");

                rpt.model         = _sample.model;
                rpt.surface_areas = _sample.surface_area;
                rpt.remark        = _sample.remarks;
            }
            return(rpt);
        }
예제 #2
0
        public void initialInfo(job_info _job, job_sample _sample)
        {
            /*INFO*/
            if (_job != null && _sample != null)
            {
                m_customer cus = new m_customer();
                cus                       = cus.SelectByID(_job.customer_id);
                lbPoNo.Text               = (_sample.sample_po == null) ? String.Empty : _sample.sample_po.ToString();
                lbDate.Text               = DateTime.Now.ToString("MM/dd/yyyy");
                lbCompany.Text            = String.Format("{0}<br />{1}", cus.company_name, cus.address);
                lbDateSampleReceived.Text = Convert.ToDateTime(_job.date_of_receive).ToString("MM/dd/yyyy");
                String[] tmp = _sample.job_number.Split('-');



                lbRefNo.Text = String.Format("{4}ATT/{0}/{1}/{2}-{3}", tmp[0], _job.date_of_receive.Value.ToString("yy"), tmp[1], tmp[2], (_sample.amend_count > 0 ? (_sample.amend_count == 1 ? "AM/" : "AM/" + _sample.amend_count) : ""));

                ////String.Format("AM/ATT/ELP/17/XXXX-XX")
                //lbDownloadName.Text = _sample.job_number.ToString();
                lbDateTestCompleted.Text = Convert.ToDateTime(_sample.due_date).ToString("MM/dd/yyyy");

                lbSampleDescription.Text = String.Format("Description:{0}<br />Model:{1}<br />Surface Area:{2}<br />Remark:{3}<br />", _sample.description, _sample.model, _sample.surface_area, _sample.remarks);

                m_specification mSpec = new m_specification();
                mSpec = mSpec.SelectByID(_sample.specification_id);
                m_type_of_test typeOfTest = new m_type_of_test();
                typeOfTest   = typeOfTest.SelectByID(_sample.type_of_test_id);
                txtSpec.Text = String.Format("Specification [{0}]-->Type Of Test [{1}]", (mSpec == null) ? String.Empty : mSpec.name, typeOfTest.name);
            }
        }