Пример #1
0
        private void button_Print_Click(object sender, EventArgs e)
        {
            int i = 0;

            // 打印票据
            if (mszFlag.ToUpper() == "FIRM_CARD")
            {
                MyTools.sPrintTopic = "卖方取款凭证";
            }
            else
            {
                MyTools.sPrintTopic = "买方取款凭证";
            }
            MyTools.sPrintID = "";

            MyTools.oPrintData      = new string[10];
            MyTools.oPrintData[i++] = "卡片号码:" + textBox_UserCardID.Text;
            MyTools.oPrintData[i++] = "持卡人名:" + UserName;
            MyTools.oPrintData[i++] = "--------------------------------------";
            MyTools.oPrintData[i++] = "卡片原额:" + textBox_OldBalance.Text;
            MyTools.oPrintData[i++] = "取款金额:" + textBox_Value.Text;
            MyTools.oPrintData[i++] = "取后余额:" + textBox_NewBalance.Text;

            MyTools.iPrintData = i;
            MyTools.PrintTicket();
        }
Пример #2
0
        private void button_PrintDetail_Click(object sender, EventArgs e)
        {
            // Print
            MyTools.sPrintTopic = "操作员汇总打印功能";
            MyTools.sPrintID    = "";

            MyTools.oPrintData = new string[3000];
            int i = 0;

            //MyTools.oPrintData[i++] = "操作员号:" + MyStart.giUserID.ToString();
            //MyTools.oPrintData[i++] = "操作员名:" + MyStart.gszUsername.ToString();
            MyTools.oPrintData[i++] = "开始统计:" + T1.ToString("yyyy-MM-dd HH:mm:ss");
            MyTools.oPrintData[i++] = "结束统计:" + T2.ToString("yyyy-MM-dd HH:mm:ss");
            MyTools.oPrintData[i++] = "----------------------------------------";
            MyTools.oPrintData[i++] = "明细情况:";
            if (dataGridView1.Rows.Count > 0)            //已经找到记录了
            {
                for (int j = 0; j < dataGridView1.Rows.Count; j++)
                {
                    MyTools.oPrintData[i++] = "IC 卡 号:" + dataGridView1.Rows[j].Cells[0].Value.ToString();
                    MyTools.oPrintData[i++] = "交易时间:" + dataGridView1.Rows[j].Cells[1].Value.ToString();
                    MyTools.oPrintData[i++] = "操作类型:" + dataGridView1.Rows[j].Cells[2].Value.ToString();
                    MyTools.oPrintData[i++] = "变化金额:" + dataGridView1.Rows[j].Cells[3].Value.ToString();
                    MyTools.oPrintData[i++] = "金额小计:" + dataGridView1.Rows[j].Cells[4].Value.ToString();

                    if (j < dataGridView1.Rows.Count - 1)
                    {
                        MyTools.oPrintData[i++] = "---------------";
                    }
                }
            }
            MyTools.oPrintData[i++] = "----------------------------------------";
            MyTools.oPrintData[i++] = "汇总情况:";
            MyTools.oPrintData[i++] = "买方充值:" + dataGridView2.Rows[0].Cells[1].Value.ToString().PadLeft(8) + "笔," +
                                      dataGridView2.Rows[1].Cells[1].Value.ToString().PadLeft(11) + "元";
            MyTools.oPrintData[i++] = "卖方充值:" + dataGridView2.Rows[0].Cells[2].Value.ToString().PadLeft(8) + "笔," +
                                      dataGridView2.Rows[1].Cells[2].Value.ToString().PadLeft(11) + "元";
            MyTools.oPrintData[i++] = "收入合计:" + dataGridView2.Rows[0].Cells[3].Value.ToString().PadLeft(8) + "笔," +
                                      dataGridView2.Rows[1].Cells[3].Value.ToString().PadLeft(11) + "元";
            MyTools.oPrintData[i++] = "----------------------------------------";

            MyTools.oPrintData[i++] = "买方取款:" + dataGridView2.Rows[0].Cells[4].Value.ToString().PadLeft(8) + "笔," +
                                      dataGridView2.Rows[1].Cells[4].Value.ToString().PadLeft(11) + "元";
            MyTools.oPrintData[i++] = "卖方取款:" + dataGridView2.Rows[0].Cells[5].Value.ToString().PadLeft(8) + "笔," +
                                      dataGridView2.Rows[1].Cells[5].Value.ToString().PadLeft(11) + "元";
            MyTools.oPrintData[i++] = "支出合计:" + dataGridView2.Rows[0].Cells[6].Value.ToString().PadLeft(8) + "笔," +
                                      dataGridView2.Rows[1].Cells[6].Value.ToString().PadLeft(11) + "元";
            MyTools.oPrintData[i++] = "----------------------------------------";

            MyTools.oPrintData[i++] = "结余合计:" + dataGridView2.Rows[0].Cells[7].Value.ToString().PadLeft(8) + "笔," +
                                      dataGridView2.Rows[1].Cells[7].Value.ToString().PadLeft(11) + "元";

            MyTools.iPrintData = i;
            MyTools.PrintTicket();
        }
Пример #3
0
        private void button_Print_Click(object sender, EventArgs e)
        {
            int i = 0;

            // Print
            MyTools.sPrintTopic = "卖方结算票据";
            MyTools.sPrintID    = "";

            MyTools.oPrintData      = new string[10];
            MyTools.oPrintData[i++] = "卡片号码:" + textBox_UserCardID.Text;
            MyTools.oPrintData[i++] = "持卡人名:" + UserName;
            MyTools.oPrintData[i++] = "--------------------------------------";
            MyTools.oPrintData[i++] = "原有金额:" + textBox_FinishBalance.Text;
            MyTools.oPrintData[i++] = "结算余额:" + textBox_UnFinishBalance.Text;
            MyTools.oPrintData[i++] = "结后余额:" + textBox_NewBalance.Text;

            MyTools.iPrintData = i;
            MyTools.PrintTicket();
        }
Пример #4
0
        private void button_Print_Click(object sender, EventArgs e)
        {
            int i = 0;

            // 打印票据
            MyTools.sPrintTopic = "买方充值凭证";
            MyTools.sPrintID    = "";

            MyTools.oPrintData      = new string[10];
            MyTools.oPrintData[i++] = "卡片号码:" + textBox_CardID.Text;
            MyTools.oPrintData[i++] = "持卡人名:" + sUserName;
            MyTools.oPrintData[i++] = "--------------------------------------";
            MyTools.oPrintData[i++] = "卡片原额:" + textBox_OldBalance.Text;
            MyTools.oPrintData[i++] = "充值金额:" + textBox_Value.Text;
            MyTools.oPrintData[i++] = "充后余额:" + textBox_NewBalance.Text;
            MyTools.oPrintData[i++] = "充值类型:" + comboBox_Type.Text.Trim();

            MyTools.iPrintData = i;
            MyTools.PrintTicket();
        }
Пример #5
0
        private void button_Print_Click(object sender, EventArgs e)
        {
            // Print
            MyTools.sPrintTopic = "操作员汇总打印功能";
            MyTools.sPrintID    = "";

            MyTools.oPrintData = new string[50];
            int i = 0;

            //MyTools.oPrintData[i++] = "操作员号:" + MyStart.giUserID.ToString();
            //MyTools.oPrintData[i++] = "操作员名:" + MyStart.gszUsername.ToString();
            MyTools.oPrintData[i++] = "开始统计:" + T1.ToString("yyyy-MM-dd HH:mm:ss");
            MyTools.oPrintData[i++] = "结束统计:" + T2.ToString("yyyy-MM-dd HH:mm:ss");
            MyTools.oPrintData[i++] = "";
            MyTools.oPrintData[i++] = "工作情况:";
            MyTools.oPrintData[i++] = "买方充值:" + dataGridView2.Rows[0].Cells[1].Value.ToString().PadLeft(8) + "笔," +
                                      dataGridView2.Rows[1].Cells[1].Value.ToString().PadLeft(11) + "元";
            MyTools.oPrintData[i++] = "卖方充值:" + dataGridView2.Rows[0].Cells[2].Value.ToString().PadLeft(8) + "笔," +
                                      dataGridView2.Rows[1].Cells[2].Value.ToString().PadLeft(11) + "元";
            MyTools.oPrintData[i++] = "收入合计:" + dataGridView2.Rows[0].Cells[3].Value.ToString().PadLeft(8) + "笔," +
                                      dataGridView2.Rows[1].Cells[3].Value.ToString().PadLeft(11) + "元";
            MyTools.oPrintData[i++] = "----------------------------------------";

            MyTools.oPrintData[i++] = "买方取款:" + dataGridView2.Rows[0].Cells[4].Value.ToString().PadLeft(8) + "笔," +
                                      dataGridView2.Rows[1].Cells[4].Value.ToString().PadLeft(11) + "元";
            MyTools.oPrintData[i++] = "卖方取款:" + dataGridView2.Rows[0].Cells[5].Value.ToString().PadLeft(8) + "笔," +
                                      dataGridView2.Rows[1].Cells[5].Value.ToString().PadLeft(11) + "元";
            MyTools.oPrintData[i++] = "支出合计:" + dataGridView2.Rows[0].Cells[6].Value.ToString().PadLeft(8) + "笔," +
                                      dataGridView2.Rows[1].Cells[6].Value.ToString().PadLeft(11) + "元";
            MyTools.oPrintData[i++] = "----------------------------------------";

            MyTools.oPrintData[i++] = "结余合计:" + dataGridView2.Rows[0].Cells[7].Value.ToString().PadLeft(8) + "笔," +
                                      dataGridView2.Rows[1].Cells[7].Value.ToString().PadLeft(11) + "元";

            MyTools.iPrintData = i;
            MyTools.PrintTicket();
        }
Пример #6
0
        private void button_CheckCard_Click(object sender, EventArgs e)
        {
            string  szInf   = "";
            string  sCardID = "";
            DataSet odt     = null;
            string  sErrMsg = "";

            if (!frm_Main.bHaveRd)
            {
                if (textBox_CardID.Text.Trim() != "")
                {
                    sCardID = textBox_CardID.Text;
                }
                else
                {
                    MessageBox.Show("没有连接读写器,也没有输入卡号,不能执行查询余额功能!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                if (!myRdr.ComOpen(frm_Main.sRdPort))
                {
                    myRdr.ComClose();
                    if (textBox_CardID.Text.Trim() != "")
                    {
                        sCardID = textBox_CardID.Text;
                    }
                    else
                    {
                        MessageBox.Show("打开串口失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
                else
                {
                    if (!myRdr.ReadCardInf(out szInf))
                    {
                        if (textBox_CardID.Text.Trim() != "")
                        {
                            sCardID = textBox_CardID.Text;
                        }
                        else
                        {
                            MessageBox.Show("读卡失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            myRdr.ComClose();
                            goto Eend;
                        }
                    }
                    else
                    {
                        sCardID = szInf.Substring(0, 16);
                    }
                }
                myRdr.ComClose();
            }
            textBox_CardID.Text = sCardID;

            if (sCardID.Substring(0, 1) == MyStart.gszCardFirmFirst)
            {
                MessageBox.Show("不接受商户卡查询余额,请换卡!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                goto Eend;
            }

            try
            {
                string sSql = "";
                if (mszFlag.ToUpper() == "FIRM_CARD")
                {
                    sSql = "SELECT * FROM mng_card WHERE STORE_CARD = '" + sCardID + "' AND card_type = 3";
                }
                else  // if (mszFlag.ToUpper() == "USER_CARD")
                {
                    sSql = "SELECT * FROM base_ucard WHERE user_card = '" + sCardID + "'";
                }

                int iRst = MyStart.oMyDb.ReadData(sSql, "TableA", ref odt, ref sErrMsg);
                if (iRst != 0)
                {
                    MessageBox.Show("后台查询卡余额失败( " + sErrMsg + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    goto Eend;
                }

                if (odt.Tables[0].Rows.Count <= 0)
                {
                    if (mszFlag.ToUpper() == "FIRM_CARD")
                    {
                        MessageBox.Show("这是错误的商户结算卡,请更换。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else  // if (mszFlag.ToUpper() == "USER_CARD")
                    {
                        MessageBox.Show("没有此用户卡的信息,请更换。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    goto Eend;
                }

                if (mszFlag.ToUpper() == "FIRM_CARD")
                {
                    sUserName = odt.Tables[0].Rows[0]["STORE_PERSON"].ToString().Trim();
                }
                else  // if (mszFlag.ToUpper() == "USER_CARD")
                {
                    sUserName = odt.Tables[0].Rows[0]["user_name"].ToString().Trim();
                }

                //银石后台
                objHttp = new EbHttpClass();
                string szErr       = "";
                int    iValue      = 0;
                int    iTrade      = 0;
                int    CardBalance = 0;
                float  fi          = 0.00f;

                if (mszFlag.ToUpper() == "FIRM_CARD")
                {
                    iTrade = 1;
                }
                else
                {
                    iTrade = 0;
                }

                bool bRst = objHttp.QryCard(sCardID, ref iValue, ref iTrade, ref szErr);
                if (!bRst)
                {
                    MessageBox.Show("后台查询卡余额失败( " + szErr + " )", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //return;
                }
                else
                {
                    if (mszFlag.ToUpper() == "FIRM_CARD")
                    {
                        fi = iValue;
                        fi = fi / 100;
                        textBox_FinishBalance.Text = fi.ToString("0.00");

                        if (iTrade > 0)
                        {
                            fi = iTrade;
                        }
                        else
                        {
                            fi = 0;
                        }
                        fi = fi / 100;
                        textBox_UnFinishBalance.Text = fi.ToString("0.00");

                        CardBalance             = iValue + iTrade;
                        fi                      = CardBalance;
                        fi                      = fi / 100;
                        textBox_OldBalance.Text = fi.ToString("0.00");
                        MyFunc.WriteToDbLog("卖方资金-余额查询", " ", "MSG", MyStart.giUserID);
                    }
                    else
                    {
                        textBox_FinishBalance.Text   = "";
                        textBox_UnFinishBalance.Text = "";
                        fi = iValue;
                        fi = fi / 100;
                        textBox_OldBalance.Text = fi.ToString("0.00");
                        MyFunc.WriteToDbLog("买方资金-余额查询", " ", "MSG", MyStart.giUserID);
                    }

                    if (checkBox1.Checked)
                    {
                        int i = 0;
                        // 打印票据
                        MyTools.sPrintTopic = "余额查询票据";
                        MyTools.sPrintID    = "";

                        MyTools.oPrintData      = new string[10];
                        MyTools.oPrintData[i++] = "卡片号码:" + textBox_CardID.Text;
                        MyTools.oPrintData[i++] = "持卡人名:" + sUserName;
                        MyTools.oPrintData[i++] = "--------------------------------------";
                        MyTools.oPrintData[i++] = "可取金额:" + textBox_FinishBalance.Text;
                        MyTools.oPrintData[i++] = "未结余额:" + textBox_UnFinishBalance.Text;
                        MyTools.oPrintData[i++] = "合计余额:" + textBox_OldBalance.Text;

                        MyTools.iPrintData = i;
                        MyTools.PrintTicket();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("查询失败 = " + ex.Message, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

Eend:
            if (odt != null)
            {
                odt.Clear();
            }
            MyStart.oMyDb.Close();

            button_CheckCard.Focus();
        }