Пример #1
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);
            }
        }
Пример #2
0
 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);
     }
 }
Пример #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
 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);
     }
 }