Ejemplo n.º 1
0
        private void ContextMenu_edit(object sender, System.EventArgs e)
        {
            String hn = "", name = "", pttid = "", vn = "";

            //pttid = grfPtt[grfPtt.Row, colPttId] != null ? grfPtt[grfPtt.Row, colPttId].ToString() : "";
            vn   = grfPtt[grfPtt.Row, colVN] != null ? grfPtt[grfPtt.Row, colVN].ToString() : "";
            hn   = grfPtt[grfPtt.Row, colHn] != null ? grfPtt[grfPtt.Row, colHn].ToString() : "";
            name = grfPtt[grfPtt.Row, colName] != null ? grfPtt[grfPtt.Row, colName].ToString() : "";

            //if (MessageBox.Show("ต้องการ แก้ไข Patient  \n  hn number " + chk + " \n name " + name, "", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.OK)
            //{
            //grfReq.Rows.Remove(grfReq.Row);
            //VisitAdd(pttid, vn, name, pttid);
            //}
            String date = "", date1 = "";

            date = DateTime.Now.Year + "-" + DateTime.Now.ToString("MM-dd");
            DataTable dt = new DataTable();

            date  = "2018-11-05";
            date1 = "05-11-2018";
            dt    = ic.ivfDB.oJpxdDB.selectByVN2(vn);
            //if (dt.Rows.Count <= 0) return;

            FrmReport frm = new FrmReport(ic);

            frm.setStickerDrugReport(date, dt, "");
            frm.ShowDialog(this);
        }
Ejemplo n.º 2
0
        private void ContextMenu_print_sticker(object sender, System.EventArgs e)
        {
            if (grfOrder.Row < 0)
            {
                return;
            }
            if (grfOrder[grfOrder.Row, colOrdid] == null)
            {
                return;
            }
            //if (!vsOld.VSID.Equals("166") && vsOld.VSID.Equals("999"))        //      -0020
            if (!vs.vsid.Equals("166") && vs.vsid.Equals("999"))                //      +0020
            {
                MessageBox.Show("รอ รับชำระ ไม่สามารถพิมพ์ Sticker ได้", "");
                //return;
            }
            String id = "", date = "";

            date = DateTime.Now.Year + "-" + DateTime.Now.ToString("MM-dd");
            CellRange cell = grfOrder.Selection;

            //if (cell is null) return;
            if (cell.TopRow < 1)
            {
                return;
            }
            for (int i = cell.TopRow; i <= cell.BottomRow; i++)
            {
                String pxid = "", status = "", re = "", edit = "", usage = "";
                pxid   = grfOrder[i, colOrdid].ToString();
                status = grfOrder[i, colOrdstatus].ToString();
                edit   = grfOrder[i, colOrdEdit].ToString();
                if (status.Equals("px"))
                {
                    id += pxid + ",";
                }
                if (cboLangSticker.Text.Trim().Equals("English"))
                {
                    usage = grfOrder[i, colOrdUsE].ToString();
                    if (edit.Equals("1"))
                    {
                        re = ic.ivfDB.oJpxdDB.updateUsageEByID(id, usage);
                    }
                }
                else
                {
                    usage = grfOrder[i, colOrdUsT].ToString();
                    if (edit.Equals("1"))
                    {
                        re = ic.ivfDB.oJpxdDB.updateUsageTByID(id, usage);
                    }
                }
            }
            id = id.Trim();
            if (id.Length > 0)
            {
                if (id.Substring(id.Length - 1).IndexOf(',') >= 0)
                {
                    id = id.Substring(0, id.Length - 1);
                }
                PrinterSettings settings = new PrinterSettings();
                printerOld = settings.PrinterName;
                SetDefaultPrinter(ic.iniC.printerSticker);

                DataTable dt = new DataTable();
                if (cboLangSticker.Text.Trim().Equals("English"))
                {
                    dt = ic.ivfDB.oJpxdDB.selectBypxidFreqEN(id);
                }
                else
                {
                    dt = ic.ivfDB.oJpxdDB.selectBypxidFreqTH(id);
                }
                if (dt.Rows.Count > 0)
                {
                    //if (dt.Rows.Count <= 0) return;
                    foreach (DataRow row in dt.Rows)
                    {
                        String qty = "", unit = "";
                        qty              = row["qty"] != null ? row["qty"].ToString() : " ";
                        unit             = row["unit_name"] != null ? row["unit_name"].ToString() : " ";
                        row["unit_name"] = qty + " " + unit;
                        //MessageBox.Show("unit "+ row["unit_name"].ToString(), "");
                    }
                    ic.ivfDB.oJpxdDB.updateStatusPrintOKByID(id);
                    if (flagedit.Equals("edit"))
                    {
                        ic.ivfDB.oJpxdDB.updateStatusUpStockOKByID(id);
                    }
                    FrmReport frm = new FrmReport(ic);
                    frm.setStickerDrugReport(date, dt, cboLangSticker.Text.Trim());
                    frm.ShowDialog(this);
                }
            }
        }
Ejemplo n.º 3
0
        private void BtnPrnSticker_Click(object sender, EventArgs e)
        {
            // throw new NotImplementedException();
            PrinterSettings settings = new PrinterSettings();

            printerOld = settings.PrinterName;
            SetDefaultPrinter(ic.iniC.printerSticker);
            //ic.logw.WriteLog("d", "PrinterSticker " + ic.iniC.printerSticker);
            String date = "", date1 = "";

            date = DateTime.Now.Year + "-" + DateTime.Now.ToString("MM-dd");
            DataTable dt = new DataTable();

            //date = "2018-11-05";
            //date1 = "05-11-2018";
            foreach (Row row in grfOrder.Rows)
            {
                String pxid = "", status = "", re = "", edit = "", usage = "";
                pxid   = row[colOrdid] != null ? row[colOrdid].ToString() : "";
                status = row[colOrdstatus] != null ? row[colOrdstatus].ToString() : "";
                edit   = row[colOrdEdit] != null ? row[colOrdEdit].ToString() : "";
                if (edit.Equals("1"))
                {
                    if (cboLangSticker.Text.Trim().Equals("English"))
                    {
                        usage = row[colOrdUsE].ToString();
                        re    = ic.ivfDB.oJpxdDB.updateUsageEByID(pxid, usage);
                    }
                    else
                    {
                        usage = row[colOrdUsT].ToString();
                        re    = ic.ivfDB.oJpxdDB.updateUsageTByID(pxid, usage);
                    }
                }
            }
            if (cboLangSticker.Text.Trim().Equals("English"))
            {
                dt = ic.ivfDB.oJpxdDB.selectByVN1FreqEN(txtVn.Text);
            }
            else
            {
                dt = ic.ivfDB.oJpxdDB.selectByVN1FreqTH(txtVn.Text);
            }

            //if (dt.Rows.Count <= 0) return;
            foreach (DataRow row in dt.Rows)
            {
                String qty = "", unit = "";
                qty              = row["qty"] != null ? row["qty"].ToString() : " ";
                unit             = row["unit_name"] != null ? row["unit_name"].ToString() : " ";
                row["unit_name"] = qty + " " + unit;
                if (ptt.f_patient_nation_id.Equals("1"))        // thai
                {
                    row["patient_name"] = ic.ivfDB.fpfDB.getList1(ptt.f_patient_prefix_id) + " " + ptt.patient_firstname + " " + ptt.patient_lastname;
                }
                //if (cboLangSticker.Text.Trim().Equals("English"))
                //{
                //    row["patient_name"] = txtPttNameE.Text.Trim();
                //}
                //else
                //{
                //    row["patient_name"] = txtPttName.Text.Trim();
                //}
                //MessageBox.Show("unit "+ row["unit_name"].ToString(), "");
            }
            ic.ivfDB.oJpxdDB.updateStatusPrintOKByVN(txtVn.Text);
            ic.ivfDB.oJpxdDB.updateStatusUpStockOKByVN(txtVn.Text);
            //PrinterSettings settings1 = new PrinterSettings();
            //settings1.DefaultPageSettings.PrinterSettings.PrinterName = ic.iniC.printerSticker;
            //settings1.PrinterName = ic.iniC.printerSticker;
            FrmReport frm = new FrmReport(ic);

            frm.setStickerDrugReport(date, dt, cboLangSticker.Text.Trim());
            frm.ShowDialog(this);
        }