Ejemplo n.º 1
0
        //TOMBOL PRINT AKAN MEMANGGIL KE METHOD INI, berguna untuk memanggil method print
        public void coba_print()
        {
            LinkApi link = new LinkApi();

            try
            {
                PrintDialog printDialog = new PrintDialog();

                PrintDocument printDocument = new PrintDocument();

                printDialog.Document = printDocument;                                //add the document to the dialog box...

                printDocument.PrinterSettings.PrinterName = link.printer_name;       //try_bi.Properties.Settings.Default.mPrinter;//seting nama printer
                printDocument.PrintPage += new PrintPageEventHandler(CreateReceipt); //add an event handler that will do the printing
                printDocument.Print();
            }
            catch (Exception ex)
            {
                //MessageBox.Show("Your Printer Name Is Unavailable", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //MessageBox.Show("Can't connect to the printer: " + try_bi.Properties.Settings.Default.mPrinter);
                MessageBox.Show("Can't connect to the printer #{" + link.printer_name /*try_bi.Properties.Settings.Default.mPrinter*/ + "}#" + ex.ToString());
                var appLog = new System.Diagnostics.EventLog("Pos Biensi");
                appLog.Source = "Printer";
                appLog.WriteEntry(ex.Message);
                //MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        //=========================================================================
        private void b_print_Click(object sender, EventArgs e)
        {
            ckon.con.Close();

            LinkApi ls = new LinkApi();

            if (ls.print_default == "1")
            {
                PrintThermal print = new PrintThermal();
                print.get_trans_id(id_list);
                print.get_nm_store();
                print.get_currency();
                print.get_trans_header();
                print.coba_print();
            }
            else
            {
                NewFunctionPrinter print = new NewFunctionPrinter();
                print.get_trans_id(id_list);
                print.get_nm_store();
                print.get_currency();
                print.get_trans_header();
                print.coba_print();
            }
        }
Ejemplo n.º 3
0
        //==============================================================================
        //private void b_stockTake_Click(object sender, EventArgs e)
        //{
        //    //Jika POS tersebut bukan PC Master maka menu ini tidak bisa diakses
        //    if (Properties.Settings.Default.MstrOrChld == "Child")
        //    {
        //        MessageBox.Show("This Menu Can Only Be Accessed By A Master PCss", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        //    }
        //    else
        //    {
        //        label3.Text = "Stock Take";
        //        UC_Stock_Take c = new UC_Stock_Take(this);
        //        p_kanan.Controls.Clear();
        //        if (!p_kanan.Controls.Contains(UC_Stock_Take.Instance))
        //        {
        //            p_kanan.Controls.Add(UC_Stock_Take.Instance);
        //            UC_Stock_Take.Instance.Dock = DockStyle.Fill;
        //            //UC_Stock_Take.Instance.from_form1();
        //            UC_Stock_Take.Instance.id_employee2 = id_employee;
        //            UC_Stock_Take.Instance.nm_employee2 = nama_employee;

        //            //UC_Stock_Take.Instance.retreive(sql);
        //            UC_Stock_Take.Instance.BringToFront();
        //        }
        //        else
        //        {
        //            //UC_Stock_Take.Instance.from_form1();
        //            UC_Stock_Take.Instance.id_employee2 = id_employee;
        //            UC_Stock_Take.Instance.nm_employee2 = nama_employee;
        //            //UC_Stock_Take.Instance.retreive(sql);
        //            UC_Stock_Take.Instance.BringToFront();
        //        }
        //    }

        //}
        //==============================================================================
        private void b_deliveryCust_Click(object sender, EventArgs e)
        {
            LinkApi link = new LinkApi();
            API_DeliveryCustomer deliv_cust = new API_DeliveryCustomer();

            //Jika POS tersebut bukan PC Master maka menu ini tidak bisa diakses
            if (Properties.Settings.Default.MstrOrChld == "Child")
            {
                MessageBox.Show("This Menu Can Only Be Accessed By A Master PCss", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                deliv_cust.getDeliveryCust(link.storeId).Wait();

                label3.Text = "Delivery Customer";
                p_kanan.Controls.Clear();
                if (!p_kanan.Controls.Contains(UC_DeliveryCustomer.Instance))
                {
                    p_kanan.Controls.Add(UC_DeliveryCustomer.Instance);
                    UC_DeliveryCustomer.Instance.Dock = DockStyle.Fill;
                    UC_DeliveryCustomer.Instance.new_();
                    UC_DeliveryCustomer.Instance.holding();
                    UC_DeliveryCustomer.Instance.BringToFront();
                }
                else
                {
                    UC_DeliveryCustomer.Instance.new_();
                    UC_DeliveryCustomer.Instance.holding();
                    UC_DeliveryCustomer.Instance.BringToFront();
                }
            }
        }
Ejemplo n.º 4
0
        public SqlConnection sqlConMsg()
        {
            LinkApi xmlCon           = new LinkApi();
            String  connectionString = "";

            connectionString = "Data Source='" + xmlCon.host_db + "';Initial Catalog='" + xmlCon.msg_db + "';User ID='" + xmlCon.user_db + "';Password='******'";
            SqlConnection sqlConMsg = new SqlConnection(connectionString);

            return(sqlConMsg);
        }
Ejemplo n.º 5
0
        private void checkConnectionString()
        {
            LinkApi    xmlCon    = new LinkApi();
            AppSetting setting   = new AppSetting();
            String     exist_con = setting.GetConnectionString("BiensiPosDbDataContextConnectionString");
            String     new_con   = string.Format("User Id={0};Password={1};Host={2};Database={3};Persist Security Info=True", xmlCon.user_db, xmlCon.pass_db, xmlCon.host_db, xmlCon.name_db);

            if (exist_con != new_con)
            {
                //save connection
                setting.SaveConnectionString("BiensiPosDbDataContextConnectionString", new_con);
                Application.Restart();
            }
        }
Ejemplo n.º 6
0
        //======================================================================
        private void payment_Load(object sender, EventArgs e)
        {
            string  command;
            LinkApi link = new LinkApi();

            this.ActiveControl = textBox1;
            textBox1.Focus();
            type = "Cash";

            try
            {
                ckon.sqlCon().Open();
                command = "SELECT * FROM store";
                CRUD sql = new CRUD();
                ckon.sqlDataRd = sql.ExecuteDataReader(command, ckon.sqlCon());

                if (ckon.sqlDataRd.HasRows)
                {
                    while (ckon.sqlDataRd.Read())
                    {
                        store_code = ckon.sqlDataRd["CODE"].ToString();
                        store_name = ckon.sqlDataRd["NAME"].ToString();
                        store_add  = ckon.sqlDataRd["ADDRESS"].ToString();
                    }
                }
                else
                {
                    store_code = link.storeId;
                }
            }
            catch (Exception er)
            {
                MessageBox.Show(er.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (ckon.sqlDataRd != null)
                {
                    ckon.sqlDataRd.Close();
                }

                if (ckon.sqlCon().State == ConnectionState.Open)
                {
                    ckon.sqlCon().Close();
                }
            }
        }
Ejemplo n.º 7
0
        //======AMBIL TOTAL DISCOUNT DARI TRANSAKSI HEADER SESUAI TERANSAKSI ID===
        public void ambil_discount_subtotal()
        {
            CRUD    sql    = new CRUD();
            LinkApi xmlCon = new LinkApi();

            try
            {
                ckon.sqlCon().Open();
                //String cmd = "SELECT * FROM [transaction] WHERE TRANSACTION_ID='" + id_transaksi3 + "'";
                String cmd = "SELECT SUM(DISCOUNTAMOUNT) as DISCOUNT, SUM(SUBTOTAL) as SUBTOTAL FROM [Tmp]." + xmlCon.storeId + " WHERE TRANSACTION_ID='" + id_transaksi3 + "'";
                ckon.sqlDataRd = sql.ExecuteDataReader(cmd, ckon.sqlCon());

                if (ckon.sqlDataRd.HasRows)
                {
                    while (ckon.sqlDataRd.Read())
                    {
                        tot_diskon = Convert.ToInt32(ckon.sqlDataRd["DISCOUNT"]);
                        tot_bel    = Convert.ToInt32(ckon.sqlDataRd["SUBTOTAL"]);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (ckon.sqlDataRd != null)
                {
                    ckon.sqlDataRd.Close();
                }

                if (ckon.sqlCon().State == ConnectionState.Open)
                {
                    ckon.sqlCon().Close();
                }
            }

            //ckon.cmd = new MySqlCommand(sql, ckon.con);
            //ckon.con.Open();
            //ckon.myReader = ckon.cmd.ExecuteReader();
            //while(ckon.myReader.Read())
            //{
            //    tot_diskon = ckon.myReader.GetInt32("DISCOUNT");
            //}
            //ckon.con.Close();
        }
Ejemplo n.º 8
0
        //==================================================================================

        //======================LIST HOLD TRANSACTION============================================
        public void holding()
        {
            CRUD    sql  = new CRUD();
            LinkApi link = new LinkApi();

            dgv_Pending.Rows.Clear();

            try
            {
                ckon.sqlCon().Open();
                String cmd = "SELECT * FROM deliverycustomer a JOIN deliverycustomer_line b "
                             + "ON a.DELIVERY_CUST_ID = b.DELIVERY_CUST_ID "
                             + "WHERE STATUS = '0' AND STORE_FROM = '" + link.storeId + "'";
                ckon.sqlDataRd = sql.ExecuteDataReader(cmd, ckon.sqlCon());

                if (ckon.sqlDataRd.HasRows)
                {
                    while (ckon.sqlDataRd.Read())
                    {
                        id_trans = ckon.sqlDataRd["DELIVERY_CUST_ID"].ToString();
                        date     = ckon.sqlDataRd["DATE"].ToString();

                        int dgRows = dgv_Pending.Rows.Add();
                        dgv_Pending.Rows[dgRows].Cells[0].Value = id_trans;
                        dgv_Pending.Rows[dgRows].Cells[1].Value = date;
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (ckon.sqlDataRd != null)
                {
                    ckon.sqlDataRd.Close();
                }

                if (ckon.sqlCon().State == ConnectionState.Open)
                {
                    ckon.sqlCon().Close();
                }
            }
        }
Ejemplo n.º 9
0
        //======================================================================
        public void fungsi_cetak_struk()
        {
            LinkApi ls = new LinkApi();

            if (ls.print_default == "1")
            {
                PrintThermal print = new PrintThermal();
                print.get_trans_id(id_trans);
                print.get_nm_store();
                print.get_currency();
                print.get_trans_header();
                print.coba_print();
            }
            else
            {
                NewFunctionPrinter print = new NewFunctionPrinter();
                print.get_trans_id(id_trans);
                print.get_nm_store();
                print.get_currency();
                print.get_trans_header();
                print.coba_print();
            }
        }
Ejemplo n.º 10
0
        private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            LinkApi ls           = new LinkApi();
            string  printer_name = ls.printer_name;

            MessageBox.Show("{System: '" + nm_printer.Text + "' #Entry: '" + printer_name + "'}");

            if (printer_name != nm_printer.Text && printer_name != "")
            {
                MessageBox.Show("Masukkan nama printer dan klik save dibawah. Buka kembali aplikasi dan test print. {System: '" + nm_printer.Text + "' #Entry: '" + printer_name + "'}");
            }
            else if (printer_name == "")
            {
                MessageBox.Show("Masukkan nama printer dan klik save dibawah. Buka kembali aplikasi dan test print. {System: '" + nm_printer.Text + "' #Entry: '" + printer_name + "'}");
            }
            else
            {
                Cursor.Current = Cursors.WaitCursor;
                Coba_Print_Baru print = new Coba_Print_Baru();
                print.coba_print();
                Cursor.Current = Cursors.Default;
            }
        }