private void Btn_Charge_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TOTALCHARGE.Text.Trim()))
            {
                mes.Show("请选择收费项目!");
                return;
            }

            if (CHARGETYPEID.SelectedValue == null || CHARGETYPEID.SelectedValue == DBNull.Value)
            {
                mes.Show("收款方式不能为空!");
                CHARGETYPEID.Focus();
                return;
            }
            else
            {
                if (CHARGETYPEID.SelectedValue.ToString() == "2")
                {
                    if (POSRUNNINGNO.Text.Trim() == "")
                    {
                        mes.Show("请输入POS机收费的交易流水号!");
                        POSRUNNINGNO.Focus();
                        return;
                    }
                }
            }

            if (_BCSS > 0m)
            {
                if (Approve_Finance())
                {
                    mes.Show("收费成功!");
                    BindDepartmentFee();
                    TOTALCHARGE.Text = "";
                    CHARGEBCSS.Text  = "";
                }
            }
            else
            {
                mes.Show("未检测到收费信息!");
            }
        }
        private void Btn_Print_Click(object sender, EventArgs e)
        {
            if (!CheckBCSS())
            {
                return;
            }
            hc["CHARGEClASS"] = 15;

            if (ReceiptPrintSign.Checked)
            {
                if (!Information.IsNumeric(RECEIPTNO.Text))
                {
                    MessageBox.Show("收据号只能由数字组成,请输入正确的收据号!");
                    RECEIPTNO.Focus();
                    return;
                }
            }

            if (!CHARGETYPEID.Text.Equals("现金"))
            {
                if (POSRUNNINGNO.Text.Trim() == "")
                {
                    MessageBox.Show("请输入交易流水号!");
                    POSRUNNINGNO.Focus();
                    return;
                }
            }
            string strCapMoney = RMBHelper.CmycurD(_BCSS);

            RECEIPTNO.Text = RECEIPTNO.Text.PadLeft(8, '0');
            if (Approve_Finance())
            {
                if (ReceiptPrintSign.Checked)
                {
                    try
                    {
                        FastReport.Report report1 = new FastReport.Report();
                        // load the existing report
                        report1.Load(Application.StartupPath + @"\PRINTModel\业扩模板\业扩决算收据模板.frx");

                        (report1.FindObject("txtReceiptNO") as FastReport.TextObject).Text        = "NO." + RECEIPTNO.Text;
                        (report1.FindObject("txtWaterUserNO") as FastReport.TextObject).Text      = "用 户 号:" + waterUserId.Text;
                        (report1.FindObject("txtSD") as FastReport.TextObject).Text               = "受理编号:" + SD.Text;
                        (report1.FindObject("txtWaterUserName") as FastReport.TextObject).Text    = "用户名称:" + waterUserName.Text;
                        (report1.FindObject("txtWaterUserAddress") as FastReport.TextObject).Text = "地    址:" + waterUserAddress.Text;

                        if (!CHARGETYPEID.Text.Equals("现金"))
                        {
                            (report1.FindObject("txtRunningNO") as FastReport.TextObject).Text = "交易流水号:" + POSRUNNINGNO.Text;
                        }
                        else
                        {
                            (report1.FindObject("txtRunningNO") as FastReport.TextObject).Text = "";
                        }

                        (report1.FindObject("txtCapMoney") as FastReport.TextObject).Text = "金额大写:" + strCapMoney;
                        (report1.FindObject("txtCasher") as FastReport.TextObject).Text   = "收 款 员:" + strRealName;
                        if (_BCSS < 0)
                        {
                            (report1.FindObject("txtWaterUserSign") as FastReport.TextObject).Text = "用户签字:";
                            (report1.FindObject("txtBCSS") as FastReport.TextObject).Text          = "本次退款:" + _BCSS.ToString("F2") + "元";
                        }
                        else
                        {
                            (report1.FindObject("txtWaterUserSign") as FastReport.TextObject).Text = "";
                            (report1.FindObject("txtBCSS") as FastReport.TextObject).Text          = "本次实收:" + _BCSS.ToString("F2") + "元";
                        }

                        (report1.FindObject("txtReceiptNO1") as FastReport.TextObject).Text        = "NO." + RECEIPTNO.Text;
                        (report1.FindObject("txtWaterUserNO1") as FastReport.TextObject).Text      = "用 户 号:" + waterUserId.Text;
                        (report1.FindObject("txtSD1") as FastReport.TextObject).Text               = "受理编号:" + SD.Text;
                        (report1.FindObject("txtWaterUserName1") as FastReport.TextObject).Text    = "用户名称:" + waterUserName.Text;
                        (report1.FindObject("txtWaterUserAddress1") as FastReport.TextObject).Text = "地    址:" + waterUserAddress.Text;

                        if (!CHARGETYPEID.Text.Equals("现金"))
                        {
                            (report1.FindObject("txtRunningNO1") as FastReport.TextObject).Text = "交易流水号:" + POSRUNNINGNO.Text;
                        }
                        else
                        {
                            (report1.FindObject("txtRunningNO1") as FastReport.TextObject).Text = "";
                        }
                        (report1.FindObject("txtCapMoney1") as FastReport.TextObject).Text = "金额大写:" + strCapMoney;
                        (report1.FindObject("txtCasher1") as FastReport.TextObject).Text   = "收 款 员:" + strRealName;
                        if (_BCSS < 0)
                        {
                            (report1.FindObject("txtWaterUserSign1") as FastReport.TextObject).Text = "用户签字:";
                            (report1.FindObject("txtBCSS1") as FastReport.TextObject).Text          = "本次退款:" + _BCSS.ToString("F2") + "元";
                        }
                        else
                        {
                            (report1.FindObject("txtWaterUserSign1") as FastReport.TextObject).Text = "";
                            (report1.FindObject("txtBCSS1") as FastReport.TextObject).Text          = "本次实收:" + _BCSS.ToString("F2") + "元";
                        }

                        //report1.Show();
                        report1.PrintSettings.ShowDialog = false;
                        report1.Prepare();
                        report1.Print();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("收据打印失败:" + ex.Message);
                    }
                    if (Information.IsNumeric(RECEIPTNO.Text))
                    {
                        RECEIPTNO.Text = (Convert.ToInt32(RECEIPTNO.Text) + 1).ToString().PadLeft(8, '0');
                    }
                    else
                    {
                        RECEIPTNO.Text = "00000001";
                    }
                }
                else
                {
                    return;
                }
                MessageBox.Show("收费成功!");
                TOTALCHARGE.Text = "0";
                CHARGEBCYS.Text  = "0";
                CHARGEBCSS.Text  = "0";
                BindDepartmentFee();

                Btn_Print.Visible  = false;
                Btn_Settle.Visible = false;
            }
            else
            {
                MessageBox.Show("结算失败!");
            }
        }
예제 #3
0
        private void Btn_Print_Click(object sender, EventArgs e)
        {
            if (RECEIPTNO.Text.Trim() == "")
            {
                mes.Show("请输入收据号!");
                RECEIPTNO.Focus();
                return;
            }
            if (!Information.IsNumeric(RECEIPTNO.Text))
            {
                mes.Show("收据号只能由数字组成!");
                RECEIPTNO.SelectAll();
                return;
            }
            RECEIPTNO.Text = RECEIPTNO.Text.PadLeft(8, '0');
            if (BLLWATERFEECHARGE.IsExistReceiptNO(RECEIPTNO.Text))
            {
                if (mes.ShowQ("系统检测到号码为'" + RECEIPTNO.Text + "'的收据已使用,确定使用此号码吗?") != DialogResult.OK)
                {
                    RECEIPTNO.SelectAll();
                    return;
                }
            }
            if (CHARGETYPEID.SelectedValue == null || CHARGETYPEID.SelectedValue == DBNull.Value)
            {
                mes.Show("收款方式不能为空!");
                CHARGETYPEID.Focus();
                return;
            }
            else
            {
                if (CHARGETYPEID.SelectedValue.ToString() == "2")
                {
                    if (POSRUNNINGNO.Text.Trim() == "")
                    {
                        mes.Show("请输入POS机收费的交易流水号!");
                        POSRUNNINGNO.Focus();
                        return;
                    }
                }
            }

            if (_BCSS > 0m)
            {
                if (Approve_Finance())
                {
                    //===================================ByRen201610170956===================================================打印收据
                    #region
                    FastReport.Report report1 = new FastReport.Report();
                    try
                    {
                        string   strWaterUserName = "", strAddress = "", strFeeName = "";
                        DateTime dtNow     = mes.GetDatetimeNow(); //获取收据打印时间
                        decimal  decDepSum = 0;

                        object objMes = htBaseMes["WATERUSERNAME"];
                        if (objMes != null && objMes != DBNull.Value)
                        {
                            strWaterUserName = objMes.ToString();
                        }

                        objMes = htBaseMes["WATERUSERADDRESS"];
                        if (objMes != null && objMes != DBNull.Value)
                        {
                            strAddress = objMes.ToString();
                        }

                        for (int i = 0; i < dtFeeItems.Rows.Count; i++)
                        {
                            string  strFeeNameSingle = "";
                            decimal decFeeSingle     = 0;

                            object obj = dtFeeItems.Rows[i]["FeeItem"];
                            if (obj != null && obj != DBNull.Value)
                            {
                                strFeeNameSingle = obj.ToString();
                            }

                            obj = dtFeeItems.Rows[i]["Fee"];
                            if (Information.IsNumeric(obj))
                            {
                                decFeeSingle = Convert.ToDecimal(obj);
                            }

                            if (strFeeName == "")
                            {
                                strFeeName = strFeeNameSingle + ":" + decFeeSingle.ToString("F2");
                            }
                            else
                            {
                                strFeeName += "\r\n" + strFeeNameSingle + ":" + decFeeSingle.ToString("F2");
                            }

                            decDepSum += decFeeSingle;
                        }

                        report1.Load(Application.StartupPath + @"\PRINTModel\收据模板\报装预算收据.frx");

                        (report1.FindObject("CellWaterUserName") as FastReport.Table.TableCell).Text    = strWaterUserName;
                        (report1.FindObject("CellWaterUserAddress") as FastReport.Table.TableCell).Text = strAddress;

                        (report1.FindObject("txtBCSS") as FastReport.TextObject).Text             = "本次实收: " + _BCSS.ToString("F2");
                        (report1.FindObject("txtYSZJ") as FastReport.TextObject).Text             = "预算总计: " + _BCSS.ToString("F2");
                        (report1.FindObject("txtFeeDetailSummery") as FastReport.TextObject).Text = strFeeDepartMent + "预算明细: ";
                        (report1.FindObject("txtFeeDetail") as FastReport.TextObject).Text        = strFeeName;

                        (report1.FindObject("txtChargeWorkerName") as FastReport.TextObject).Text = strRealName;
                        (report1.FindObject("txtReceiptNO") as FastReport.TextObject).Text        = "NO." + RECEIPTNO.Text.PadLeft(8, '0');

                        string strCapMoney = RMBToCapMoney.CmycurD(_BCSS.ToString("F2"));
                        if (CHARGETYPEID.SelectedValue.ToString() == "2")
                        {
                            (report1.FindObject("txtCapMoney") as FastReport.TextObject).Text = "金额大写:" + strCapMoney + "   " + "交易流水号:" + POSRUNNINGNO.Text;
                        }
                        else
                        {
                            (report1.FindObject("txtCapMoney") as FastReport.TextObject).Text = "金额大写:" + strCapMoney;
                        }

                        report1.PrintSettings.ShowDialog = false;
                        report1.Prepare();
                        report1.Print();

                        //获取新的收据号码,8位收据号
                        if (Information.IsNumeric(RECEIPTNO.Text))
                        {
                            RECEIPTNO.Text = (Convert.ToInt64(RECEIPTNO.Text) + 1).ToString().PadLeft(8, '0');
                        }
                    }
                    catch (Exception exx)
                    {
                        MessageBox.Show(exx.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    finally
                    {
                        // free resources used by report
                        report1.Dispose();
                    }
                    #endregion
                    //=========================================================================

                    mes.Show("收费成功!");
                    BindDepartmentFee();
                    TOTALCHARGE.Text = "";
                    CHARGEBCSS.Text  = "";
                }
            }
            else
            {
                mes.Show("未检测到收费信息!");
            }
        }