Exemple #1
0
        private void txtCena_Leave(object sender, EventArgs e)
        {
            try
            {
                Price = float.Parse(txtCena.Text.Replace("Kč", ""));
                SazbaDPH AktDPH = DPHAll.Find(x => x.idSazbaDPH == (int)cmbDPH.SelectedValue);
                PriceNoDPH = Price * 100 / (100 + AktDPH.SazbaDPH1 ?? 0);

                if (Quantity > 0)
                {
                    BasePrice      = Price / Quantity;
                    BasePriceNoDPH = PriceNoDPH / Quantity;
                }
                else
                {
                    BasePrice      = 0;
                    BasePriceNoDPH = 0;
                }
                txtCenaBezDPH.Text = Helper.DoubleToMoney(PriceNoDPH);
                if (txtJednotkovaCena.Text != String.Format("{0:0.00}", BasePrice))
                {
                    txtJednotkovaCena.Text = String.Format("{0:0.00}", BasePrice);
                    if (PriceNoVatChanged != null)
                    {
                        PriceNoVatChanged(this, InvoiceOrder);
                    }
                }
            }
            catch (Exception EX)
            {
                txtJednotkovaCena.Text = String.Format("{0:0.00}", 0);
            }
            finally { }
        }
Exemple #2
0
 private void txtPocet_Leave(object sender, EventArgs e)
 {
     try
     {
         double dTemp;
         double.TryParse(txtPocet.Text, out dTemp);
         Quantity     = dTemp;
         txtCena.Text = String.Format("{0:0.00}", BasePrice * Quantity);
         Price        = BasePrice * Quantity;
         SazbaDPH AktDPH = DPHAll.Find(x => x.idSazbaDPH == (int)cmbDPH.SelectedValue);
         PriceNoDPH         = Price * 100 / (100 + AktDPH.SazbaDPH1 ?? 0);
         BasePriceNoDPH     = BasePrice * 100 / (100 + AktDPH.SazbaDPH1 ?? 0);
         txtCenaBezDPH.Text = Helper.DoubleToMoney(PriceNoDPH);
     }
     catch (Exception EX)
     {
         txtCena.Text = String.Format("{0:0.00}", 0);
     }
     finally { }
 }
Exemple #3
0
 private void txtJednotkovaCena_Leave(object sender, EventArgs e)
 {
     try
     {
         BasePrice = float.Parse(txtJednotkovaCena.Text.Replace("Kč", ""));
         Price     = BasePrice * Quantity;
         SazbaDPH AktDPH = DPHAll.Find(x => x.idSazbaDPH == (int)cmbDPH.SelectedValue);
         PriceNoDPH     = Price * 100 / (100 + AktDPH.SazbaDPH1 ?? 0);
         BasePriceNoDPH = BasePrice * 100 / (100 + AktDPH.SazbaDPH1 ?? 0);
         if (txtCena.Text != String.Format("{0:0.00}", Price))
         {
             txtCena.Text       = String.Format("{0:0.00}", Price);
             txtCenaBezDPH.Text = Helper.DoubleToMoney(PriceNoDPH);
         }
     }
     catch (Exception EX)
     {
         txtCena.Text = String.Format("{0:0.00}", 0);
     }
     finally { }
 }