Ejemplo n.º 1
0
 private void tServiceValue_TextChanged(object sender, EventArgs e)
 {
     try {
         double dValue = 0;
         for (int t = 0; t <= lvList.Items.Count - 1; t++)
         {
             dValue = Convert.ToDouble(tServiceValue.Text) * (Convert.ToDouble(lvList.Items[t].SubItems[2].Text) / 100);
             lvList.Items[t].SubItems[3].Text = MyModules.FormatDouble(dValue);
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 2
0
        public void LoadService(int strCode)
        {
            try
            {
                SqlConnection cnSQL = new SqlConnection(MyModules.strConnect);
                SqlCommand    cmSQL = new SqlCommand();
                cmSQL.Connection = cnSQL;
                cnSQL.Open();
                SqlDataReader drSQL = null;
                Flush();
                string dReward = "0";
                cmSQL.CommandText = "SELECT Services.*, Register.Outline FROM Services INNER JOIN Register ON Services.RefNo = Register.Code WHERE Sn=" + strCode;
                cmSQL.CommandType = CommandType.Text;
                drSQL             = cmSQL.ExecuteReader();
                while (drSQL.Read())
                {
                    tTransNo.Text        = drSQL["Sn"].ToString();
                    dtpDate.Text         = drSQL["TransDate"].ToString();
                    tRefNo.Text          = drSQL["RefNo"].ToString();
                    tClientsDetails.Text = drSQL["Telephone"].ToString() + " (" + drSQL["Name"].ToString() + ")";
                    tServiceDetails.Text = drSQL["ServiceRendered"].ToString();
                    tServiceValue.Text   = MyModules.FormatDouble(drSQL["ValueOfService"]);
                    tAmountPaid.Text     = MyModules.FormatDouble(drSQL["AmountPaid"]);
                    dReward       = MyModules.FormatDouble(drSQL["AmountChargedFromReward"]);
                    ClientOutline = drSQL["Outline"].ToString();
                }

                tRewardBalance.Text = MyModules.FormatDouble(GetClientReward(tRefNo.Text) + Convert.ToDouble(dReward));
                tReward.Text        = Convert.ToDouble(dReward).ToString();

                drSQL.Close();

                cnSQL.Close();

                GetSubLevel(tRefNo.Text);


                double dValue = 0;
                for (int t = 0; t <= lvList.Items.Count - 1; t++)
                {
                    dValue = Convert.ToDouble(tServiceValue.Text) * (Convert.ToDouble(lvList.Items[t].SubItems[2].Text) / 100);
                    lvList.Items[t].SubItems[3].Text = MyModules.FormatDouble(dValue);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 3
0
        private void cmdClient_Click(object sender, EventArgs e)
        {
            using (var form = new FrmList("Clients", "List of Clients"))
            {
                var result = form.ShowDialog();
                if (result == DialogResult.OK)
                {
                    tRefNo.Text          = form.ReturnValue.ToString();
                    tClientsDetails.Text = form.ReturnValue1.ToString() + " (" + form.ReturnValue2.ToString() + ")";
                    ClientOutline        = form.ReturnValue3.ToString();

                    GetSubLevel(tRefNo.Text);
                    tRewardBalance.Text = MyModules.FormatDouble(GetClientReward(tRefNo.Text));
                    tServiceValue_TextChanged(sender, e);
                }
            }
        }
Ejemplo n.º 4
0
        private void tReward_TextChanged(object sender, EventArgs e)
        {
            if (tRewardBalance.Text == "")
            {
                tRewardBalance.Text = "0";
            }
            if (tReward.Text == "")
            {
                tReward.Text = "0";
            }
            if (Convert.ToDouble(tReward.Text) > Convert.ToDouble(tRewardBalance.Text))
            {
                MessageBox.Show("Exceeds Available Reward", MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                tReward.Text = "0";
            }

            tAmountPaid.Text = MyModules.FormatDouble(Convert.ToDouble(tServiceValue.Text) - Convert.ToDouble(tReward.Text));
        }
Ejemplo n.º 5
0
        public void GetRewardSummary()
        {
            try
            {
                SqlConnection cnSQL = new SqlConnection(MyModules.strConnect);
                SqlCommand    cmSQL = new SqlCommand();
                cmSQL.Connection = cnSQL;
                SqlDataReader drSQL;

                cnSQL.Open();

                cmSQL.CommandText = "SELECT ISNULL(SUM([Reward]),0) AS Reward,ISNULL(SUM(AmountDrawnFromReward),0) AS AmountDrawnFromReward FROM Ledger";
                cmSQL.CommandType = System.Data.CommandType.Text;
                drSQL             = cmSQL.ExecuteReader();
                if (drSQL.HasRows == false)
                {
                    lblRewardDrawn.Text       = "0.0";
                    lblRewardBalance.Text     = "0.0";
                    lblTotalRewardEarned.Text = "0.0";
                }
                else
                {
                    if (drSQL.Read())
                    {
                        lblRewardDrawn.Text       = MyModules.FormatDouble(drSQL["AmountDrawnFromReward"]);
                        lblRewardBalance.Text     = MyModules.FormatDouble(Convert.ToDouble(drSQL["Reward"]) - Convert.ToDouble(drSQL["AmountDrawnFromReward"]));
                        lblTotalRewardEarned.Text = MyModules.FormatDouble(drSQL["Reward"]);
                    }
                }


                //cmSQL.Connection.Close()
                cmSQL.Dispose();
                drSQL.Close();
                cnSQL.Close();
                //cnSQL.Dispose()
            }
            catch //(Exception ex)
            {
                // MessageBox.Show(ex.Message, MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 6
0
 private void tReward_Leave(object sender, EventArgs e)
 {
     tReward.Text = MyModules.FormatDouble(tReward.Text);
 }
Ejemplo n.º 7
0
 private void tAmountPaid_Leave(object sender, EventArgs e)
 {
     tAmountPaid.Text = MyModules.FormatDouble(tAmountPaid.Text);
 }
Ejemplo n.º 8
0
 private void tServiceValue_Leave(object sender, EventArgs e)
 {
     tServiceValue.Text = MyModules.FormatDouble(tServiceValue.Text);
     tReward.Text       = "0";
     tAmountPaid.Text   = "0";
 }