Exemple #1
0
        private void GRD_SLIP_Scroll(object sender, ScrollEventArgs e)
        {
            int firstDisplayed = GRD_SLIP.FirstDisplayedScrollingRowIndex;
            int displayed      = GRD_SLIP.DisplayedRowCount(true);
            int lastVisible    = (firstDisplayed + displayed) - 1;
            int lastIndex      = GRD_SLIP.RowCount - 1;

            if (lastVisible == lastIndex)//마지막행으로 스크롤되면 자동으로 추가 조회 하도록 하는 기능을..
            {
            }
        }
 public void CLEAR()
 {
     if (detailsSlip != null)
     {
         detailsSlip.Hide();
     }
     int nRow = GRD_SLIP.RowCount;
     for (int i = nRow - 1; i >= 0; i--)
     {
         GRD_SLIP.Rows.RemoveAt(i);
     }
     GRD_SLIP.Refresh();
     preAction = string.Empty;
     txt_DocId.Text = string.Empty;
     txt_StartDate.Value = DateTime.Today;
     txt_PurchaseAmt.Text = string.Empty;
     txt_InvoiceNo.Text = string.Empty;
 }
Exemple #3
0
        public void CLEAR()
        {
            if (detailsSlip != null)
            {
                detailsSlip.Hide();
            }
            int nRow = GRD_SLIP.RowCount;

            for (int i = nRow - 1; i >= 0; i--)
            {
                GRD_SLIP.Rows.RemoveAt(i);
            }
            GRD_SLIP.Refresh();

            txt_DocId.Text       = "";
            txt_InvoiceNo.Text   = "";
            txt_PurchaseAmt.Text = "0.00";
            txt_StartDate.Text   = "";
            txt_EndDate.Text     = "";
        }
        private void searchList(string page_num)
        {
            JObject jsonReq = new JObject();

            try
            {
                cmbbox_Page.SelectedIndex = int.Parse(page_num) - 1;

                Transaction tran = new Transaction();
                Utils       util = new Utils();

                string start_date = util.FormatConvertDate(TXT_REFUND_FROMDATE.Value.ToString());
                string end_date   = util.FormatConvertDate(TXT_REFUND_TODATE.Value.ToString());

                jsonReq.Add("displayNum", display_num);
                jsonReq.Add("pageNum", page_num);

                jsonReq.Add("companyID", "000001");
                jsonReq.Add("languageCD", "jp");
                jsonReq.Add("user_desk_id", Constants.DESK_ID);
                jsonReq.Add("merchant_no", Constants.MERCHANT_NO);

                jsonReq.Add("dateFrom", start_date);
                jsonReq.Add("dateTo", end_date);

                if (!TXT_SLIP_NO.Text.Equals(""))
                {
                    jsonReq.Add("slip_no", TXT_SLIP_NO.Text);
                }

                if (!TXT_TOTAL_SLIPSEQ.Text.Equals("")) //TOTAL_SLIPSEQ
                {
                    jsonReq.Add("total_slipseq", TXT_TOTAL_SLIPSEQ.Text);
                }

                if (!COM_DATE_COND.SelectedValue.ToString().Equals(""))
                {
                    jsonReq.Add("dateCond", COM_DATE_COND.SelectedValue.ToString());
                }

                string refund_status_code = COM_REFUND_STATUS.SelectedValue.ToString();
                if (!refund_status_code.Equals(""))
                {
                    if (COM_REFUND_STATUS.SelectedValue.ToString().Equals("ALL"))
                    {
                        refund_status_code = null;
                    }
                    jsonReq.Add("refund_status_code", refund_status_code);
                }

                string strResult = tran.onlineSearch(jsonReq.ToString());

                JArray a = JArray.Parse(strResult);

                int nRow = GRD_SLIP.RowCount;
                for (int i = nRow - 1; i >= 0; i--)
                {
                    GRD_SLIP.Rows.RemoveAt(i);
                }
                GRD_SLIP.Refresh();

                if (a == null || a.Count == 0)
                {
                    MetroMessageBox.Show(this, Constants.getMessage("NO_SERACH_DATA"), "Search", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    m_strLastSearchDate = start_date;
                    GRD_SLIP.Rows.Add(a.Count);
                    for (int i = 0; i < a.Count; i++)
                    {
                        JObject tempObj = (JObject)a[i];
                        GRD_SLIP[0, i].Value  = (i + 1).ToString();
                        GRD_SLIP[1, i].Value  = tempObj["SLIP_NO"].ToString();
                        GRD_SLIP[2, i].Value  = tempObj["SALEDT"].ToString();
                        GRD_SLIP[3, i].Value  = tempObj["MERCHANT_JPNM"].ToString();
                        GRD_SLIP[4, i].Value  = Int64.Parse(tempObj["TOTAL_EXCOMM_SALE_AMT"].ToString());
                        GRD_SLIP[5, i].Value  = Int64.Parse(tempObj["TOTAL_EXCOMM_TAX_AMT"].ToString());
                        GRD_SLIP[6, i].Value  = Int64.Parse(tempObj["TOTAL_EXCOMM_REFUND_AMT"].ToString());
                        GRD_SLIP[7, i].Value  = Int64.Parse(tempObj["TOTAL_COMM_SALE_AMT"].ToString());
                        GRD_SLIP[8, i].Value  = Int64.Parse(tempObj["TOTAL_COMM_TAX_AMT"].ToString());
                        GRD_SLIP[9, i].Value  = Int64.Parse(tempObj["TOTAL_COMM_REFUND_AMT"].ToString());
                        GRD_SLIP[10, i].Value = tempObj["REFUND_STATUS_CODE_DESC"].ToString();
                        GRD_SLIP[11, i].Value = tempObj["TOTAL_SLIPSEQ"].ToString();
                        GRD_SLIP[12, i].Value = tempObj["WORKERID"].ToString();
                        GRD_SLIP[13, i].Value = tempObj["SEND_FLAG"].ToString();
                        //GRD_SLIP[13, i].Value = Int64.Parse(tempObj["RETRY_CNT"].ToString());
                        GRD_SLIP[14, i].Value = tempObj["REFUND_STATUS_CODE"].ToString();
                        GRD_SLIP[15, i].Value = tempObj["REFUND_WAY_CODE"].ToString();
                        GRD_SLIP[16, i].Value = tempObj["PROGRESS_STATUS_CODE"].ToString();
                        tempObj = null;
                    }
                }
                tran = null;
            }
            catch (Exception ex)
            {
                Constants.LOGGER_MAIN.Error(ex.StackTrace);
                MetroMessageBox.Show(this, Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/SearchFaild"),
                                     "Search", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void BTN_SEARCH_Click(object sender, EventArgs e)
        {
            if (!BTN_SEARCH.Enabled)
            {
                return;
            }

            BTN_SEARCH.Enabled = false;
            JObject jsonReq = new JObject();

            init_num = 1;

            int nRow = GRD_SLIP.RowCount;

            for (int i = nRow - 1; i >= 0; i--)
            {
                GRD_SLIP.Rows.RemoveAt(i);
            }
            GRD_SLIP.Refresh();

            try
            {
                setWaitCursor(true);

                /*
                 * TimeSpan between_date = TXT_REFUND_TODATE.Value - TXT_REFUND_FROMDATE.Value;
                 * int date_cnt = between_date.Days;
                 *
                 * if (DateTime.Compare(TXT_REFUND_FROMDATE.Value, TXT_REFUND_TODATE.Value) > 0)
                 * {
                 *  MessageBox.Show(Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/ValidateSearchDate"));
                 *  return;
                 * }
                 * else if (date_cnt > 10)
                 * {
                 *
                 *  MessageBox.Show(Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/ExceedSearchDate"));
                 *  return;
                 * }
                 */

                Transaction tran = new Transaction();
                Utils       util = new Utils();

                string start_date = util.FormatConvertDate(TXT_REFUND_FROMDATE.Value.ToString());
                string end_date   = util.FormatConvertDate(TXT_REFUND_TODATE.Value.ToString());

                jsonReq.Add("companyID", "000001");
                jsonReq.Add("languageCD", "jp");
                jsonReq.Add("user_desk_id", Constants.DESK_ID);
                jsonReq.Add("merchant_no", Constants.MERCHANT_NO);
                jsonReq.Add("dateFrom", start_date);
                jsonReq.Add("dateTo", end_date);

                if (!TXT_SLIP_NO.Text.Equals(""))
                {
                    jsonReq.Add("slip_no", TXT_SLIP_NO.Text);
                }

                if (!TXT_TOTAL_SLIPSEQ.Text.Equals("")) //TOTAL_SLIPSEQ
                {
                    jsonReq.Add("total_slipseq", TXT_TOTAL_SLIPSEQ.Text);
                }

                if (!COM_DATE_COND.SelectedValue.ToString().Equals(""))
                {
                    jsonReq.Add("dateCond", COM_DATE_COND.SelectedValue.ToString());
                }

                string refund_status_code = COM_REFUND_STATUS.SelectedValue.ToString();
                if (!refund_status_code.Equals(""))
                {
                    if (COM_REFUND_STATUS.SelectedValue.ToString().Equals("ALL"))
                    {
                        refund_status_code = "";
                    }
                    else
                    {
                        jsonReq.Add("refund_status_code", refund_status_code);
                    }
                }

                string page      = "1";
                int    total_cnt = tran.onlineSearchCount(jsonReq.ToString());
                if (total_cnt > 0)
                {
                    if (cmbbox_Page.Items.Count > 0)
                    {
                        cmbbox_Page.Items.Clear();
                    }

                    int    i         = 0;
                    double quotient  = total_cnt / display_num;
                    double remainder = total_cnt % display_num;

                    double tot_page = 0;
                    if (remainder != 0)
                    {
                        tot_page = System.Math.Truncate(quotient);
                    }
                    else
                    {
                        tot_page = System.Math.Truncate(quotient) - 1;
                    }

                    for (i = 0; i <= tot_page; i++)
                    {
                        cmbbox_Page.Items.Add(i + 1);
                    }

                    searchList(page);
                }
                else
                {
                    MetroMessageBox.Show(this, Constants.getMessage("NO_SERACH_DATA"), "Search", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                setWaitCursor(false);
                BTN_SEARCH.Enabled = true;
            }
        }
Exemple #6
0
        private void BTN_SEARCH_Click(object sender, EventArgs e)
        {
            if (!BTN_SEARCH.Enabled)
            {
                return;
            }
            BTN_SEARCH.Enabled = false;
            JObject jsonReq = new JObject();

            init_num = 1;

            int nRow = GRD_SLIP.RowCount;

            for (int i = nRow - 1; i >= 0; i--)
            {
                GRD_SLIP.Rows.RemoveAt(i);
            }
            GRD_SLIP.Refresh();

            try
            {
                setWaitCursor(true);
                TimeSpan between_date = txt_EndDate.Value - txt_StartDate.Value;
                int      date_cnt     = between_date.Days;

                if (DateTime.Compare(txt_StartDate.Value, txt_EndDate.Value) > 0)
                {
                    MessageBox.Show(Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/ValidateSearchDate"));
                    return;
                }
                else if (date_cnt > 10)
                {
                    MessageBox.Show(Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/ExceedSearchDate"));
                    return;
                }
                jsonReq.Add("group_id", Constants.GROUP_ID);
                jsonReq.Add("start_date", Util.Utils.FormatConvertDate(txt_StartDate.Text));
                jsonReq.Add("end_date", Util.Utils.FormatConvertDate(txt_EndDate.Text));
                jsonReq.Add("shop_id", Constants.MID);

                if (!txt_DocId.Text.Replace(".", "").Replace(" ", "").Equals(""))
                {
                    jsonReq.Add("doc_id", txt_DocId.Text.Replace(".", "").Replace(" ", ""));
                }

                if (!txt_InvoiceNo.Equals(""))
                {
                    jsonReq.Add("receipt_no", txt_InvoiceNo.Text);
                }

                string value = txt_PurchaseAmt.Text.Replace(",", "").Replace("$", "");
                if (!txt_PurchaseAmt.Text.Equals("") && (decimal.Parse(value) > 0))
                {
                    jsonReq.Add("receipt_amt", value);
                }

                Transaction tran = new Transaction();

                string page      = "1";
                int    total_cnt = tran.searchReceiptCount(jsonReq.ToString());
                if (total_cnt > 0)
                {
                    if (cmbbox_Page.Items.Count > 0)
                    {
                        cmbbox_Page.Items.Clear();
                    }

                    int    i         = 0;
                    double quotient  = total_cnt / display_num;
                    double remainder = total_cnt % display_num;

                    double tot_page = 0;
                    if (remainder != 0)
                    {
                        tot_page = System.Math.Truncate(quotient);
                    }
                    else
                    {
                        tot_page = System.Math.Truncate(quotient) - 1;
                    }

                    for (i = 0; i <= tot_page; i++)
                    {
                        cmbbox_Page.Items.Add(i + 1);
                    }

                    searchList(page);
                }
                else
                {
                    //MessageBox.Show(Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/DataNotFound"));
                    MetroMessageBox.Show(this, Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/DataNotFound"),
                                         "Search", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                setWaitCursor(false);
                BTN_SEARCH.Enabled = true;
            }
        }
Exemple #7
0
        private void searchList(string page_num)
        {
            JObject jsonReq = new JObject();

            try
            {
                cmbbox_Page.SelectedIndex = int.Parse(page_num) - 1;

                Transaction tran = new Transaction();

                jsonReq.Add("display_num", display_num);
                jsonReq.Add("page_num", page_num);

                jsonReq.Add("group_id", Constants.GROUP_ID);
                jsonReq.Add("start_date", Util.Utils.FormatConvertDate(txt_StartDate.Text));
                jsonReq.Add("end_date", Util.Utils.FormatConvertDate(txt_EndDate.Text));
                jsonReq.Add("shop_id", Constants.MID);

                if (!txt_DocId.Text.Replace(".", "").Replace(" ", "").Equals(""))
                {
                    jsonReq.Add("doc_id", txt_DocId.Text.Replace(".", "").Replace(" ", ""));
                }

                if (!txt_InvoiceNo.Equals(""))
                {
                    jsonReq.Add("receipt_no", txt_InvoiceNo.Text);
                }

                string value = txt_PurchaseAmt.Text.Replace(",", "").Replace("$", "");
                if (!txt_PurchaseAmt.Text.Equals("") && (decimal.Parse(value) > 0))
                {
                    jsonReq.Add("receipt_amt", value);
                }

                string strResult = tran.searchReceiptList(jsonReq.ToString());

                int nRow = GRD_SLIP.RowCount;
                for (int i = nRow - 1; i >= 0; i--)
                {
                    GRD_SLIP.Rows.RemoveAt(i);
                }
                GRD_SLIP.Refresh();

                if (!strResult.Equals(""))
                {
                    nRow = GRD_SLIP.RowCount;

                    JArray a = JArray.Parse(strResult);

                    int i = 0;
                    foreach (JObject json in a.Children <JObject>())
                    {
                        GRD_SLIP.Rows.Add();

                        GRD_SLIP.Rows[nRow + i].Cells["No"].Value           = json["row_no"].ToString();
                        GRD_SLIP.Rows[nRow + i].Cells["Outlet"].Value       = json["group_name"].ToString();
                        GRD_SLIP.Rows[nRow + i].Cells["StoreName"].Value    = json["store_name"].ToString();
                        GRD_SLIP.Rows[nRow + i].Cells["GSTNo"].Value        = json["gst_no"].ToString();
                        GRD_SLIP.Rows[nRow + i].Cells["ReceiptNo"].Value    = json["receipt_no"].ToString();
                        GRD_SLIP.Rows[nRow + i].Cells["PurchaseDate"].Value = Util.Utils.FormatDate(json["purchase_date"].ToString());
                        GRD_SLIP.Rows[nRow + i].Cells["PurchaseAmt"].Value  = json["purchase_amt"].ToString();
                        GRD_SLIP.Rows[nRow + i].Cells["PurchaseItem"].Value = json["purchase_item"].ToString();
                        GRD_SLIP.Rows[nRow + i].Cells["IssueDate"].Value    = json["issue_date"].ToString();
                        GRD_SLIP.Rows[nRow + i].Cells["DocId"].Value        = Util.Utils.FormatDocId(json["doc_id"].ToString());

                        /*
                         * GRD_SLIP.Rows[nRow + i].Cells["SalesAmt"].Value = json["sales_amt"].ToString();
                         * GRD_SLIP.Rows[nRow + i].Cells["GSTAmt"].Value = json["gst_amt"].ToString();
                         * GRD_SLIP.Rows[nRow + i].Cells["RefundAmt"].Value = json["refund_amt"].ToString();
                         */
                        GRD_SLIP.Rows[nRow + i].Cells["Status"].Value     = json["status_name"].ToString();;
                        GRD_SLIP.Rows[nRow + i].Cells["StatusCode"].Value = json["status"].ToString();;
                        i++;
                    }
                }
                else
                {
                    //MessageBox.Show(Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/DataNotFound"));
                    MetroMessageBox.Show(this, Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/DataNotFound"),
                                         "Search", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                Constants.LOGGER_MAIN.Error(ex.StackTrace);
                MetroMessageBox.Show(this, Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/SearchFaild"),
                                     "Search", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void BTN_SEARCH2_Click(object sender, EventArgs e)
        {
            BTN_SEARCH2.Enabled = false;
            JObject jsonReq = new JObject();
            init_num = 1;
            int nRow = GRD_SLIP.RowCount;
            for (int i = nRow - 1; i >= 0; i--)
            {
                GRD_SLIP.Rows.RemoveAt(i);
            }
            GRD_SLIP.Refresh();

            try
            {
                setWaitCursor(true);
                string value = txt_PurchaseAmt.Text.Replace(",", "").Replace("$", "");
                jsonReq.Add("group_id", Constants.GROUP_ID);
                jsonReq.Add("start_date", Util.Utils.FormatConvertDate(txt_StartDate.Text));
                jsonReq.Add("end_date", string.Empty);
                jsonReq.Add("doc_id", string.Empty);
                if(txt_InvoiceNo.Text.Equals("") || (decimal.Parse(value) < 1))
                {
                    MetroMessageBox.Show(this, Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/SearchValidate"),
                      "Search", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (!txt_InvoiceNo.Text.Equals(""))
                {
                    jsonReq.Add("receipt_no", txt_InvoiceNo.Text);
                }

                if (!txt_PurchaseAmt.Text.Equals("") && (decimal.Parse(value) > 0))
                {
                    jsonReq.Add("receipt_amt", value);
                }
                jsonReq.Add("gst_no", string.Empty);
                Transaction tran = new Transaction();

                string page = "1";
                int total_cnt = tran.searchDocIdCount(jsonReq.ToString());
                if (total_cnt > 0)
                {
                    if (cmbbox_Page.Items.Count > 0)
                        cmbbox_Page.Items.Clear();

                    int i = 0;
                    double quotient = total_cnt / display_num;
                    double remainder = total_cnt % display_num;

                    double tot_page = 0;
                    if (remainder != 0)
                    {
                        tot_page = System.Math.Truncate(quotient);
                    }
                    else
                    {
                        tot_page = System.Math.Truncate(quotient) - 1;
                    }

                    for (i = 0; i <= tot_page; i++)
                    {
                        cmbbox_Page.Items.Add(i + 1);
                    }

                    //searchListByInvoice(page);
                    preAction = "BTN_SEARCH2";
                    cmbbox_Page.SelectedIndex = 0;
                }
                else
                {
                    MetroMessageBox.Show(this, Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/DataNotFound"),
                       "Search", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                Constants.LOGGER_MAIN.Error(ex.StackTrace);
            }
            finally
            {
                BTN_SEARCH2.Enabled = true;
                setWaitCursor(false);
            }
        }
        private void COM_STORE_SelectedIndexChanged(object sender, EventArgs e)
        {
            int nRow = GRD_SLIP.RowCount;
            for (int i = nRow - 1; i >= 0; i--)
            {
                GRD_SLIP.Rows.RemoveAt(i);
            }
            GRD_SLIP.Refresh();

            if (COM_STORE.SelectedIndex == 0)
            {
                BTN_SEARCH.Enabled = false;
            }
            else
            {
                BTN_SEARCH.Enabled = true;

                JObject jsonStore = Constants.merchant_list[(COM_STORE.SelectedIndex - 1)].ToObject<JObject>();
                if (jsonStore["mid"] != null)
                {
                    Constants.MID = jsonStore["mid"].ToString();
                }
                if (jsonStore["tid"] != null)
                {
                    Constants.TID = jsonStore["tid"].ToString();
                }
                if (jsonStore["gst_no"] != null)
                {
                    Constants.GST_NO = jsonStore["gst_no"].ToString();
                }
                if (jsonStore["rec_prefix"] != null)
                {
                    Constants.REC_PREFIX = jsonStore["rec_prefix"].ToString();
                }
                if (jsonStore["dup_rc"] != null)
                {
                    Constants.DUP_RC = jsonStore["dup_rc"].ToString();
                }
                if (jsonStore["rec_digits"] != null)
                {
                    Constants.REC_DIGITS = jsonStore["rec_digits"].ToString();
                }
                if (jsonStore["item_code1"] != null)
                {
                    Constants.ITEM_CODE1 = jsonStore["item_code1"].ToString();
                }
                if (jsonStore["item_code2"] != null)
                {
                    Constants.ITEM_CODE2 = jsonStore["item_code2"].ToString();
                }
                if (jsonStore["item_code3"] != null)
                {
                    Constants.ITEM_CODE3 = jsonStore["item_code3"].ToString();
                }
                if (jsonStore["item_code4"] != null)
                {
                    Constants.ITEM_CODE4 = jsonStore["item_code4"].ToString();
                }
                if (jsonStore["item_code5"] != null)
                {
                    Constants.ITEM_CODE5 = jsonStore["item_code5"].ToString();
                }

            }
        }