public static void UpdateCompletedTransView()
        {
            int             iIndex;
            string          sQuery;
            OleDbCommand    dbCmd;
            OleDbDataReader drRecordSet;

            /* SqlCommand dbCmd;
             * SqlDataReader drRecordSet;*/
            DB.TransStruct myTransStruct;



            Debug.WriteLine("UPDATE COMPLETE TRANSACTIONS VIEW");

            SQL_SERVER.Set_Sql_Server_Conn();
            SQL_SERVER.Open_Sql_Server_Conn();


            //sQuery = "SELECT COMPLETED_TIME, PIC, PUMP, DEPOSIT, PURCHASE, PRICE, CHANGE, GRADE, VOLUME, SHOW_TIME, TRAN_ID FROM TRANSACTIONS ORDER BY COMPLETED_TIME DESC";

            sQuery = "SELECT COMPLETED_TIME, PIC, PUMP, DEPOSIT, PURCHASE, PRICE, GRADE, VOLUME, SHOW_TIME, TRAN_ID,CHANGE FROM TRANSACTIONS ORDER BY COMPLETED_TIME DESC;";
            dbCmd  = SQL_SERVER.Set_Sql_Server_Cmd(sQuery);

            drRecordSet = dbCmd.ExecuteReader();

            Debug.WriteLine(sQuery);
            Debug.WriteLine(drRecordSet.HasRows);

            iCount = 0;
            DB.lCompletedTrans.Clear();
            while (drRecordSet.Read())
            {
                myTransStruct.sPIC      = drRecordSet["PIC"].ToString();
                myTransStruct.sPump     = drRecordSet["PUMP"].ToString();
                myTransStruct.sDeposit  = drRecordSet["DEPOSIT"].ToString();
                myTransStruct.sPurchase = drRecordSet["PURCHASE"].ToString();
                myTransStruct.sPrice    = drRecordSet["PRICE"].ToString();
                myTransStruct.sChange   = drRecordSet["CHANGE"].ToString();
                myTransStruct.sGrade    = drRecordSet["GRADE"].ToString();
                myTransStruct.sVolume   = drRecordSet["VOLUME"].ToString();
                myTransStruct.sShowTime = drRecordSet["SHOW_TIME"].ToString();
                myTransStruct.sTranId   = drRecordSet["TRAN_ID"].ToString();

                DB.lCompletedTrans.Add(myTransStruct);
                iCount++;
            }

            for (iIndex = 0; iIndex < 6; iIndex++)
            {
                if (iIndex < iCount)
                {
                    tv.pump_no.Text = DB.lCompletedTrans[iIndex].sPump.ToString();
                    Transactions_View.Update_Transactions_ButtonText(iIndex + 1, "PUMP: " + DB.lCompletedTrans[iIndex].sPump + " @ " + DB.lCompletedTrans[iIndex].sShowTime + " PAID: $" + DB.lCompletedTrans[iIndex].sDeposit + "  \nCHANGE: $" + DB.lCompletedTrans[iIndex].sChange);
                }
            }
            dbCmd.Dispose();
            drRecordSet.Dispose();
            SQL_SERVER.Close_Sql_Sever_Conn();
        }
Exemplo n.º 2
0
        private void SetTransactionsDetails(string transac_id)
        {
            IsPrintable = true;
            OleDbCommand    dbCmd;
            OleDbDataReader drRecordSet;


            SQL_SERVER.Set_Sql_Server_Conn();
            SQL_SERVER.Open_Sql_Server_Conn();


            //sQuery = "SELECT COMPLETED_TIME, PIC, PUMP, DEPOSIT, PURCHASE, PRICE, CHANGE, GRADE, VOLUME, SHOW_TIME, TRAN_ID FROM TRANSACTIONS ORDER BY COMPLETED_TIME DESC";

            string sQuery = "SELECT  PUMP, DEPOSIT,PURCHASE, VOLUME, SHOW_TIME, TRAN_ID,CHANGE FROM TRANSACTIONS WHERE TRAN_ID LIKE '%" + transac_id + "%' ORDER BY COMPLETED_TIME DESC;";

            dbCmd = SQL_SERVER.Set_Sql_Server_Cmd(sQuery);

            drRecordSet = dbCmd.ExecuteReader();

            Debug.WriteLine(sQuery);
            Debug.WriteLine(drRecordSet.HasRows);


            if (drRecordSet.HasRows)
            {
                while (drRecordSet.Read())
                {
                    pump_no.Text = drRecordSet["PUMP"].ToString();
                    deposit.Text = drRecordSet["DEPOSIT"].ToString() + "$";

                    change.Text = drRecordSet["CHANGE"].ToString() + "$";

                    gal.Text       = drRecordSet["VOLUME"].ToString() + " gal";
                    date_time.Text = drRecordSet["SHOW_TIME"].ToString();
                    var    cultureInfo = new System.Globalization.CultureInfo("en-US");
                    double purchage    = Convert.ToDouble(drRecordSet["PURCHASE"].ToString(), cultureInfo);
                    double deposite    = Convert.ToDouble(drRecordSet["DEPOSIT"].ToString(), cultureInfo);
                    total.Text = (deposite - purchage).ToString();
                }


                dbCmd.Dispose();
                drRecordSet.Dispose();
                SQL_SERVER.Close_Sql_Sever_Conn();
            }
        }
Exemplo n.º 3
0
        private void on_off_Click(object sender, EventArgs e)
        {
            if (on_off.Text == "OFF")
            {
                on_off.Text = "ON";
            }
            else if (on_off.Text == "ON")
            {
                on_off.Text = "OFF";
            }

            if (on_off.Text == "ON")
            {
                on_off.ForeColor = Color.Green;

                new SetDataTime().Show();
            }
            else if (on_off.Text == "OFF")
            {
                on_off.ForeColor = Color.Red;

                DB.IsGenerateEOD_report = false;
                SQL_SERVER.Open_Sql_Server_Conn();
                String QueryStr;



                try
                {
                    QueryStr = "UPDATE [Auto_EOD_Config] SET [AUTOEOD]='DISABLE' where [ID]=1";
                    SQL_SERVER.ExecuteNonQuery(QueryStr);
                    //SQL_SERVER.ExecuteNonQuery(QueryStr);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("Not Update data from Auto_EOD_Config table :" + ex);
                }

                SQL_SERVER.Close_Sql_Sever_Conn();

                //UpdatesConfig.Replace(UpdatesConfig.Substring(UpdatesConfig.IndexOf("<AUTOEOD>") + 9, (UpdatesConfig.IndexOf("</AUTOEOD>") - UpdatesConfig.IndexOf("<AUTOEOD>") - 9)),""

                Display.ShowMessageBox("Off Automatic Day Close", 4);
            }
        }
        private void GetChooseTransations(string datetimeformate)
        {
            int             iIndex;
            string          sQuery;
            OleDbCommand    dbCmd;
            OleDbDataReader drRecordSet;

            /* SqlCommand dbCmd;
             * SqlDataReader drRecordSet;*/
            DB.TransStruct myTransStruct;



            Debug.WriteLine("UPDATE COMPLETE TRANSACTIONS VIEW");

            SQL_SERVER.Set_Sql_Server_Conn();
            SQL_SERVER.Open_Sql_Server_Conn();


            //sQuery = "SELECT COMPLETED_TIME, PIC, PUMP, DEPOSIT, PURCHASE, PRICE, CHANGE, GRADE, VOLUME, SHOW_TIME, TRAN_ID FROM TRANSACTIONS ORDER BY COMPLETED_TIME DESC";

            sQuery = "SELECT COMPLETED_TIME, PIC, PUMP, DEPOSIT, PURCHASE, PRICE, GRADE, VOLUME, SHOW_TIME, TRAN_ID,CHANGE FROM TRANSACTIONS WHERE SHOW_TIME LIKE '%" + datetimeformate + "%' ORDER BY COMPLETED_TIME DESC;";
            dbCmd  = SQL_SERVER.Set_Sql_Server_Cmd(sQuery);

            drRecordSet = dbCmd.ExecuteReader();

            Debug.WriteLine(sQuery);
            Debug.WriteLine(drRecordSet.HasRows);


            if (drRecordSet.HasRows)
            {
                iCount = 0;
                DB.lCompletedTrans.Clear();
                ClearButtonTexts();
                ClearSelection();
                ClearTransactionsDetails();

                while (drRecordSet.Read())
                {
                    myTransStruct.sPIC      = drRecordSet["PIC"].ToString();
                    myTransStruct.sPump     = drRecordSet["PUMP"].ToString();
                    myTransStruct.sDeposit  = drRecordSet["DEPOSIT"].ToString();
                    myTransStruct.sPurchase = drRecordSet["PURCHASE"].ToString();
                    myTransStruct.sPrice    = drRecordSet["PRICE"].ToString();
                    myTransStruct.sChange   = drRecordSet["CHANGE"].ToString();
                    myTransStruct.sGrade    = drRecordSet["GRADE"].ToString();
                    myTransStruct.sVolume   = drRecordSet["VOLUME"].ToString();
                    myTransStruct.sShowTime = drRecordSet["SHOW_TIME"].ToString();
                    myTransStruct.sTranId   = drRecordSet["TRAN_ID"].ToString();

                    DB.lCompletedTrans.Add(myTransStruct);
                    iCount++;
                }

                for (iIndex = 0; iIndex < 6; iIndex++)
                {
                    if (iIndex < iCount)
                    {
                        Update_Transactions_ButtonText(iIndex + 1, "PUMP: " + DB.lCompletedTrans[iIndex].sPump + " @ " + DB.lCompletedTrans[iIndex].sShowTime + " PAID: $" + DB.lCompletedTrans[iIndex].sDeposit + "\nCHANGE: $" + DB.lCompletedTrans[iIndex].sChange);
                    }
                }


                iPage = 1;

                if (DB.lCompletedTrans.Count <= 6 * iPage)
                {
                    ButtonVisibility(next_btn, false);
                }
                if (DB.lCompletedTrans.Count >= 6 * iPage)
                {
                    ButtonVisibility(next_btn, true);
                }
            }
            else
            {
                Display.ShowMessageBox("Not Available Selected date Transations \n Showing All Available Transactions", 6);
            }
            dbCmd.Dispose();
            drRecordSet.Dispose();
            SQL_SERVER.Close_Sql_Sever_Conn();
        }
Exemplo n.º 5
0
        private void PrintReceipt(string trnasc_id)
        {
            Debug.WriteLine("TRYING TO PRINT... STATUS + " + Printer.iStatus);

            if (Printer.iStatus == 1)
            {
                string sPIC      = "";
                string sPump     = "";
                string sGrade    = "";
                string sVolume   = "";
                string sPurchase = "";
                string sPrice    = "";
                string sDeposit  = "";
                string sChange   = "";
                string sShowTime = "";
                string sTranId   = "";
                string sReceipt  = "";

                OleDbCommand    dbCmd;
                OleDbDataReader drRecordSet;


                SQL_SERVER.Set_Sql_Server_Conn();
                SQL_SERVER.Open_Sql_Server_Conn();


                //sQuery = "SELECT COMPLETED_TIME, PIC, PUMP, DEPOSIT, PURCHASE, PRICE, CHANGE, GRADE, VOLUME, SHOW_TIME, TRAN_ID FROM TRANSACTIONS ORDER BY COMPLETED_TIME DESC";

                string sQuery = "SELECT COMPLETED_TIME, PIC, PUMP, DEPOSIT, PURCHASE, PRICE, GRADE, VOLUME, SHOW_TIME, TRAN_ID,CHANGE FROM TRANSACTIONS WHERE TRAN_ID LIKE '%" + trnasc_id + "%' ORDER BY COMPLETED_TIME DESC;";
                dbCmd = SQL_SERVER.Set_Sql_Server_Cmd(sQuery);

                drRecordSet = dbCmd.ExecuteReader();

                Debug.WriteLine(sQuery);
                Debug.WriteLine(drRecordSet.HasRows);


                if (drRecordSet.HasRows)
                {
                    while (drRecordSet.Read())
                    {
                        sPIC      = drRecordSet["PIC"].ToString();
                        sPump     = drRecordSet["PUMP"].ToString();
                        sGrade    = drRecordSet["GRADE"].ToString();
                        sVolume   = drRecordSet["VOLUME"].ToString();
                        sPurchase = drRecordSet["PURCHASE"].ToString();
                        sPrice    = drRecordSet["PRICE"].ToString();
                        sDeposit  = drRecordSet["DEPOSIT"].ToString();
                        sChange   = drRecordSet["CHANGE"].ToString();
                        sShowTime = drRecordSet["SHOW_TIME"].ToString();
                        sTranId   = drRecordSet["TRAN_ID"].ToString();
                    }



                    sReceipt = sReceipt + Printer.sHeader;
                    sReceipt = sReceipt + "\n\n\n";

                    sReceipt = sReceipt + "Pump: " + sPump + "\n";
                    sReceipt = sReceipt + "Terminal: " + sPIC + "\n\n";

                    sReceipt = sReceipt + "Descr.           qty               amount" + "\n";
                    sReceipt = sReceipt + "------           ---               ------" + "\n";
                    sReceipt = sReceipt + sGrade + "               " + sVolume + "               " + sPurchase + "\n";
                    sReceipt = sReceipt + "                @ " + sPrice + "/G" + "\n";
                    sReceipt = sReceipt + "                Prepay Fuel        -" + sDeposit + ".00" + "\n";
                    sReceipt = sReceipt + "                                 --------" + "\n";
                    sReceipt = sReceipt + "                    Subtotal        -" + sChange + "\n";
                    sReceipt = sReceipt + "                         Tax         0.00" + "\n";
                    sReceipt = sReceipt + "                       TOTAL        -" + sChange + "\n";
                    sReceipt = sReceipt + "                        CASH        -" + sChange + "\n\n";

                    sReceipt = sReceipt + "TRAN# " + sTranId + "\n";
                    sReceipt = sReceipt + sShowTime + "\n\n";
                    sReceipt = sReceipt + Printer.sFooter + "\n\n\n\n\n\n\n\n\n\n\n\n\n";

                    Printer.sReceipt     = sReceipt;
                    CenCom.bPrintRequest = true;

                    Debug.WriteLine(sReceipt);

                    //MessageBox.Show(sReceipt + "");

                    dbCmd.Dispose();
                    drRecordSet.Dispose();
                    SQL_SERVER.Close_Sql_Sever_Conn();
                }
            }
            else
            {
                Display.ShowMessageBox("Printer Offline", 3);
            }
        }