コード例 #1
0
        public void cashierReportBySendingSMS(String dt_frm, String dt_to)
        {
            String outlet = "All";
            String WHERE  = "";

            DataTable dt = db.QueryBySQLCode("SELECT SUM(CASE WHEN ol.pay_code='101' AND COALESCE(ol.item_code,'')='' THEN (-1 * ol.ln_amnt) ELSE 0.00 END) AS cash, SUM(CASE WHEN ol.pay_code='102' AND COALESCE(ol.item_code,'')='' THEN (-1 * ol.ln_amnt) ELSE 0.00 END) AS dcard, SUM(CASE WHEN ol.pay_code='103' AND COALESCE(ol.item_code,'')='' THEN (-1 * ol.ln_amnt) ELSE 0.00 END) AS card, SUM(CASE WHEN ol.pay_code='114' AND COALESCE(ol.item_code,'')='' THEN (-1 * ol.ln_amnt) ELSE 0.00 END) AS check, SUM(CASE WHEN ol.pay_code NOT IN('101','102','103','114') THEN (-1 * ol.ln_amnt) ELSE 0.00 END) AS other, SUM(CASE WHEN COALESCE(ol.item_code,'')<>'' THEN ol.ln_amnt ELSE 0.00 END) AS sales, SUM(CASE WHEN COALESCE(ol.item_code,'')<>'' THEN ol.ln_tax ELSE 0.00 END) AS tax_amnt, SUM(CASE WHEN COALESCE(ol.item_code,'')<>'' THEN ol.disc_amt ELSE 0.00 END) AS disc_amnt FROM rssys.orhdr o LEFT JOIN rssys.orlne ol ON o.ord_code=ol.ord_code WHERE " + WHERE + " (o.ord_date BETWEEN '" + dt_frm + "' AND '" + dt_to + "') ");

            if (dt != null)
            {   //keys : cash dcard card price other sales tax_amnt disc_amnt
                if (dt.Rows.Count == 1)
                {
                    String grand_cash        = dt.Rows[0]["cash"].ToString();
                    String grand_debit_card  = dt.Rows[0]["dcard"].ToString();
                    String grand_credit_card = dt.Rows[0]["cash"].ToString();
                    String grand_check       = dt.Rows[0]["check"].ToString();
                    String grand_other       = dt.Rows[0]["other"].ToString();
                    String grand_sales       = dt.Rows[0]["sales"].ToString();
                    String grand_tax_amnt    = dt.Rows[0]["tax_amnt"].ToString();
                    String grand_disc_amnt   = dt.Rows[0]["disc_amnt"].ToString();

                    String message = "Good day! " + comp_name + " " + db.get_branchname(db.get_m99branch()) + " " + (dt_frm == dt_to ? "Daily" : "Monthly") + " Sales Report this day " + DateTime.Now.ToString("MM-dd-yyyy") + "\n *Cash = " + grand_cash + "\n *Credit Card = " + grand_credit_card + "\n *Check = " + grand_check + "\n *Other Charges = " + grand_other + "\n\n- This message is auto-generated by Right Apps System.\nThank you.";

                    SMS       sms = new SMS();
                    DataTable dt1 = new DataTable();
                    dt1 = db.QueryBySQLCode("SELECT * FROM rssys.auto_sms");
                    if (dt1.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt1.Rows.Count; i++)
                        {
                            g_number = dt1.Rows[i]["contact_no"].ToString();
                            sms.sendSingleSms(g_number, message);
                        }
                    }
                }
            }

            /*
             * Good day! <m99.CompanyName> <BranchName> Daily Sales Report this day <date>
             * Cash = 1,000,000,000.00
             * Credit Card = 1,000,000,000.00
             * Check = 1,000,000,000.00
             * Other Charges = 1,000,000,000.00
             * - This message is auto-generated by Right Apps System.
             * Thank you.
             */
        }