예제 #1
0
파일: PrintDao.cs 프로젝트: gudaling/hotel
        public PrintModel GetPrintConfig(PrintModel mPrint, ObjectControls oCtrl)
        {
            string sql = @"SELECT A.PRINT_ID, A.PRINT_NAME, A.PRINT_NO,A.START_X,A.START_Y,A.TABLE_ALIGN,
                              A.LAND_SCAPE,B.PRINT_DETAIL_ID,
                              B.CONTENT_DESC, B.FONT_SIZE, B.FONT_COLOR,
                              B.FONT_BOLD, B.FONT_UNDER_LINE, B.ALIGN, B.SITE_X, B.SITE_Y, B.BIND_VALUE, B.VALUE_TYPE,
                              B.CREATE_DATE, B.CREATE_USERID
                        FROM PRINT_HEADER AS A INNER JOIN
                              PRINT_DETAIL AS B ON A.PRINT_ID = B.PRINT_ID";
            oCtrl.Helper(oCtrl.Exsit(MCtrl.ByPrintNo) && oCtrl.Append(ref sql, " AND A.PRINT_NO=" + SQL(mPrint.PrintNo)));
            oCtrl.Helper(oCtrl.Exsit(MCtrl.ByPrintId) && oCtrl.Append(ref sql, " AND A.PRINT_ID=" + SQL(mPrint.PrintId)));

            sdr = ExecuteReader(sql);
            using (sdr)
            {
                PrintModel mPrintNew = new PrintModel();
                mPrintNew.PrintDetailList = new List<PrintDetailModel>();
                while (sdr.Read())
                {
                    mPrintNew.PrintId = ToInt32(sdr["PRINT_ID"]);
                    mPrintNew.PrintNo = ToString(sdr["PRINT_NO"]);
                    mPrintNew.PrintName = ToString(sdr["PRINT_NAME"]);
                    mPrintNew.StartX = ToInt32(sdr["START_X"]);
                    mPrintNew.StartY = ToInt32(sdr["START_Y"]);
                    mPrintNew.TableAlign = ToInt32(sdr["TABLE_ALIGN"]);
                    mPrintNew.LandScape = ToInt32(sdr["LAND_SCAPE"]);
                    PrintDetailModel mPrintDetail = new PrintDetailModel();
                    mPrintDetail.PrintDetailId = ToInt32(sdr["PRINT_DETAIL_ID"]);
                    mPrintDetail.ContentDesc = ToString(sdr["CONTENT_DESC"]);
                    mPrintDetail.FontSize = ToInt32(sdr["FONT_SIZE"]);
                    mPrintDetail.sFontColor = ToString(sdr["FONT_COLOR"]);
                    mPrintDetail.nBold = ToInt32(sdr["FONT_BOLD"]);
                    mPrintDetail.nUnderLine = ToInt32(sdr["FONT_UNDER_LINE"]);
                    mPrintDetail.Align = ToInt32(sdr["ALIGN"]);
                    mPrintDetail.SiteX = ToInt32(sdr["SITE_X"]);
                    mPrintDetail.SiteY = ToInt32(sdr["SITE_Y"]);
                    mPrintDetail.BindValue = ToString(sdr["BIND_VALUE"]);
                    mPrintDetail.ValueType = ToChar(sdr["VALUE_TYPE"]);
                    mPrintDetail.CommonInfo.CreateDate = ToDateTime(sdr["CREATE_DATE"]);
                    mPrintDetail.CommonInfo.CreateUserId = ToInt32(sdr["CREATE_USERID"]);
                    mPrintNew.PrintDetailList.Add(mPrintDetail);
                }
                return mPrintNew;
            }
        }
예제 #2
0
        private void PintCertificate()
        {
            DataGridView dgv = new DataGridView();
            dgv.Columns.Add("ConsumeName", "消费项目");
            dgv.Columns.Add("UnitPrice", "单价");
            dgv.Columns.Add("Unit", "单位");
            dgv.Columns.Add("Number", "消费数量");
            dgv.Columns.Add("TotalMoney", "应收");

            dgv.Columns["ConsumeName"].Width = dgvConsumeDetail.Columns["ConsumeName"].Width;
            dgv.Columns["UnitPrice"].Width = dgvConsumeDetail.Columns["UnitPrice"].Width;
            dgv.Columns["Unit"].Width = dgvConsumeDetail.Columns["Unit"].Width;
            dgv.Columns["Number"].Width = dgvConsumeDetail.Columns["Number"].Width;
            dgv.Columns["TotalMoney"].Width = dgvConsumeDetail.Columns["TotalMoney"].Width;
            dgv.Width = dgv.Columns["ConsumeName"].Width
                + dgv.Columns["UnitPrice"].Width
                + dgv.Columns["Unit"].Width
                + dgv.Columns["Number"].Width
                + dgv.Columns["TotalMoney"].Width;

            dgv.AllowUserToAddRows = false;

            int i = 0;
            foreach (DataGridViewRow dgvr in dgvConsumeDetail.Rows)
            {
                dgv.Rows.Add();
                dgv.Rows[i].Cells["ConsumeName"].Value = dgvr.Cells["ConsumeName"].Value;
                dgv.Rows[i].Cells["UnitPrice"].Value = dgvr.Cells["UnitPrice"].Value;
                dgv.Rows[i].Cells["Unit"].Value = dgvr.Cells["Unit"].Value;
                dgv.Rows[i].Cells["Number"].Value = dgvr.Cells["Number"].Value;
                dgv.Rows[i].Cells["TotalMoney"].Value = dgvr.Cells["TotalMoney"].Value;
                i++;
            }
            dgv.Rows.Add();
            //dgv.Rows[i].Cells["ConsumeName"].Value = "合计:";
            //dgv.Rows[i].Cells["UnitPrice"].Value = dTotal.ToString();
            //dgv.Rows[i].Cells["Unit"].Value = "找零:";
            //dgv.Rows[i].Cells["Number"].Value = listCustomerStay[0].Deposit - dTotal;
            dgv.Rows[i].Cells["ConsumeName"].Value = "合计:";
            dgv.Rows[i].Cells["UnitPrice"].Value = dTotal.ToString();
            dgv.Rows[i].Cells["Unit"].Value = "押金:";
            dgv.Rows[i].Cells["Number"].Value =+ listCustomerStay[0].Deposit;
            dgv.Rows[i].Cells["TotalMoney"].Value = "找零:" + (listCustomerStay[0].Deposit - dTotal).ToString();

            if (dgvConsumeDetail.Rows.Count > 0)
            {
                PrintInfo bPrint = new PrintInfo();
                PrintModel mPrint = new PrintModel();
                mPrint = bPrint.GetPrintModel(new PrintModel("FormPayMoney"), new ObjectControls(MCtrl.ByPrintNo));
                CommonModel mComm = new CommonModel();
                mPrint = bPrint.GetPrintSet(mPrint, new Object[] { UserInfo });
                DataGridViewPrint dgvp = new DataGridViewPrint(new DataGridView[] { dgv });
                dgvp.GetPrintConfig = mPrint;
                dgvp.Print(true,false);
            }
        }
예제 #3
0
        private void PintCertificate()
        {
            DataGridView dgv = new DataGridView();
            dgv.Columns.Add("Name", "姓名");
            dgv.Columns.Add("ToTime", "抵店日期");
            dgv.Columns.Add("OutTime", "抵店时间");

            dgv.Columns.Add("ConsumeName", "消费项目");
            dgv.Columns.Add("UnitPrice", "单价");
            dgv.Columns.Add("Unit", "单位");
            dgv.Columns.Add("Number", "消费数量");
            dgv.Columns.Add("TotalMoney", "应收");
            //dgv.Columns["Name"].Width = dgvConsumeDetail.Columns["Name"].Width;
            dgv.Columns["ConsumeName"].Width = dgvConsumeDetail.Columns["ConsumeName"].Width;
            dgv.Columns["UnitPrice"].Width = dgvConsumeDetail.Columns["UnitPrice"].Width;
            dgv.Columns["Unit"].Width = dgvConsumeDetail.Columns["Unit"].Width;
            dgv.Columns["Number"].Width = dgvConsumeDetail.Columns["Number"].Width;
            dgv.Columns["TotalMoney"].Width = dgvConsumeDetail.Columns["TotalMoney"].Width;

            dgv.Width = dgv.Columns["ConsumeName"].Width
             + dgv.Columns["UnitPrice"].Width
             + dgv.Columns["Unit"].Width
             + dgv.Columns["Number"].Width
             + dgv.Columns["TotalMoney"].Width;

            dgv.AllowUserToAddRows = true;

            int i = 0;
            foreach (DataGridViewRow dgvr in dgvConsumeDetail.Rows)
            {
                dgv.Rows.Add();
                dgv.Rows[i].Cells["ConsumeName"].Value = dgvr.Cells["ConsumeName"].Value;
                dgv.Rows[i].Cells["UnitPrice"].Value = dgvr.Cells["UnitPrice"].Value;
                dgv.Rows[i].Cells["Unit"].Value = dgvr.Cells["Unit"].Value;
                dgv.Rows[i].Cells["Number"].Value = dgvr.Cells["Number"].Value;
                dgv.Rows[i].Cells["TotalMoney"].Value = dgvr.Cells["TotalMoney"].Value;
                i++;
            }
            dgv.Rows.Add();
            dgv.Rows[i].Cells["ConsumeName"].Value = "合计:";
            dgv.Rows[i].Cells["UnitPrice"].Value = txtTotal.Text;
            dgv.Rows[i].Cells["Unit"].Value = "押金:" ;
            dgv.Rows[i].Cells["Number"].Value = lblDeposit.Text;
            dgv.Rows[i].Cells["TotalMoney"].Value = "找零:" + (double.Parse(lblDeposit.Text) - double.Parse(txtTotal.Text)).ToString();

            if (dgvConsumeDetail.Rows.Count > 0)
            {
                PrintInfo bPrint = new PrintInfo();
                PrintModel mPrint = new PrintModel();
                mPrint = bPrint.GetPrintModel(new PrintModel(this.Name), new ObjectControls(MCtrl.ByPrintNo));
                CommonModel mComm = new CommonModel();
                mPrint = bPrint.GetPrintSet(mPrint, new Object[] { UserInfo });
                DataGridViewPrint dgvp = new DataGridViewPrint(new DataGridView[] { dgv });
                dgvp.GetPrintConfig = mPrint;
                dgvp.Print(true, false);
            }
        }
예제 #4
0
파일: PrintInfo.cs 프로젝트: gudaling/hotel
        /// <summary>
        /// 根据设置信息,将值进行处理,返回符合当前需求的打印设置信息.
        /// </summary>
        /// <param name="mPrint"></param>
        /// <param name="parame"></param>
        /// <returns></returns>
        public PrintModel GetPrintSet(PrintModel mPrint, Object[] parame)
        {
            if (Cmn.CheckEOF(mPrint.PrintDetailList))
            {
                foreach (PrintDetailModel mPrintDetail in mPrint.PrintDetailList)
                {
                    object objValue = "";
                    PropertyInfo pi;
                    if (mPrintDetail.ValueType== 'D')
                    {
                        if (parame != null)
                        {
                            foreach (Object obj in parame)
                            {
                                if (obj.GetType().Name == mPrintDetail.BindValue.Split('.')[0])
                                {
                                    pi = obj.GetType().GetProperty(mPrintDetail.BindValue.Split('.')[1]);
                                    if (pi != null)
                                    {
                                        objValue = pi.GetValue(obj, null);
                                    }
                                    objValue = objValue != null ? objValue : "";
                                    mPrintDetail.ContentDesc = string.Format(mPrintDetail.ContentDesc, objValue);
                                }
                            }
                        }
                    }
                    //switch (mPrintDetail.ValueType.ToString())
                    //{
                    //    case "S":
                    //        break;
                    //    case "U":

                    //        break;
                    //    case "O":
                    //        foreach (Object obj in parame)
                    //        {
                    //            if (obj.GetType().Name == mPrintDetail.BindValue.Split('.')[0])
                    //            {
                    //                pi = obj.GetType().GetProperty(mPrintDetail.BindValue.Split('.')[1]);
                    //                if (pi != null)
                    //                {
                    //                    objValue = pi.GetValue(obj, null);
                    //                }
                    //                objValue = objValue != null ? objValue : "";
                    //                mPrintDetail.ContentDesc = string.Format(mPrintDetail.ContentDesc, objValue);
                    //            }
                    //        }
                    //        //if (obj != null)
                    //        //{
                    //        //    pi = obj.GetType().GetProperty(mPrintDetail.BindValue);
                    //        //    if (pi != null)
                    //        //    {
                    //        //        objValue = pi.GetValue(obj, null);
                    //        //    }
                    //        //    objValue = objValue != null ? objValue : "";
                    //        //}
                    //        //mPrintDetail.ContentDesc = string.Format(mPrintDetail.ContentDesc, objValue);
                    //        break;
                    //    default:
                    //        break;
                    //}
                }
            }
            return mPrint;
        }
예제 #5
0
파일: PrintInfo.cs 프로젝트: gudaling/hotel
        /// <summary>
        /// 获取打印的设置信息
        /// </summary>
        /// <param name="mPrint"></param>
        /// <param name="oCtrl"></param>
        /// <returns></returns>
        public PrintModel GetPrintModel(PrintModel mPrint, ObjectControls oCtrl)
        {
            return dPrint.GetPrintConfig(mPrint, oCtrl);

            //return mPrint;
        }
예제 #6
0
파일: RptHelper.cs 프로젝트: gudaling/hotel
 private void pbtnPrint_Click(object sender, EventArgs e)
 {
     if (dgv.Rows.Count>0)
     {
         PrintInfo bPrint = new PrintInfo();
         PrintModel mPrint = new PrintModel();
         mPrint = bPrint.GetPrintModel(new PrintModel(FormName), new ObjectControls(MCtrl.ByPrintNo));
         CommonModel mComm = new CommonModel();
         mComm.StartDate = StartTime;
         mComm.EndDate = EndTime;
         mPrint = bPrint.GetPrintSet(mPrint, new Object[] { mUserInfo, mComm });
         DataGridViewPrint dgvp = new DataGridViewPrint(new DataGridView[] { dgv });
         dgvp.GetPrintConfig = mPrint;
         dgvp.Print(ShowDialog, DrawLine);
     }
 }
예제 #7
0
 private void pbtnPrint_Click(object sender, EventArgs e)
 {
     if (cmn.CheckEOF(listCustomerStay))
     {
         PrintModel mPrint = new PrintModel();
         mPrint = bPrint.GetPrintModel(new PrintModel(this.Name), new ObjectControls(MCtrl.ByPrintNo));
         CommonModel mComm=new CommonModel ();
         mComm.StartDate=GetDateTimePickValue(dtpStart, cboHourS);
         mComm.EndDate= GetDateTimePickValue(dtpEnd, cboHourE);
         mPrint = bPrint.GetPrintSet(mPrint,new Object[]{UserInfo,mComm});
         DataGridViewPrint dgvp = new DataGridViewPrint(new DataGridView[] { dgvIncomeInfo });
         dgvp.GetPrintConfig = mPrint;
         dgvp.Print(true,true);
     }
 }