Example #1
0
 public void AdaugaPlata(Plata plata)
 {
     if (platiPeFactura == null)
     {
         platiPeFactura = new List <Plata>();
     }
     platiPeFactura.Add(plata);
 }
Example #2
0
 public void InsertPlataTest()
 {
     var target = new Plata
     {
         Data = DateTime.Now,
         Numar = "Testing",
         Serie = "Testing",
         Suma = 123.312m,
         TipPlata = "Testing"
     };
     var r = target.Save();
     if (r.Status == StatusEnum.Errors)
     {
         Assert.Fail();
     }
 }
Example #3
0
 public void AdaugaPlata(Plata plata)
 {
     if (platiPeFactura == null)
     {
         platiPeFactura = new List<Plata>();
     }
     platiPeFactura.Add(plata);
 }
Example #4
0
 public void UpdatePlataTest()
 {
     var target = new Plata
     {
         Data = DateTime.Now,
         Numar = "Modificat",
         Serie = "Testing",
         Suma = 123.3m,
         TipPlata = "Modificat",
         ID = 1
     };
     var r = target.Save();
     if (r.Status == StatusEnum.Errors)
     {
         Assert.Fail();
     }
 }
Example #5
0
 private bool PlatesteFactura(FacturaIntrare factura, decimal plataPartiala = 0m, bool plataAutomata = true)
 {
     var sumaDePlatit = sumaDisponibila > factura.SumaRamasaDePlatit ? factura.SumaRamasaDePlatit : sumaDisponibila;
     if (plataPartiala != 0)
     {
         sumaDePlatit = plataPartiala;
     }
     else
     {
         if (!plataAutomata)
         {
             if (MessageBox.Show("Doriti sa achitati aceasta factua integral?", "Plata factura", MessageBoxButtons.YesNo) != DialogResult.Yes) return false;
         }
     }
     var plata = new Plata
     {
         Data = dataDtp.Value,
         Numar = nrTbox.Text,
         Serie = serieTbox.Text,
         Suma = sumaDePlatit,
         TipPlata = TipPlata
     };
     var errors = plata.GetErrorString();
     if (errors.Trim() != string.Empty)
     {
         MessageBox.Show(errors);
         return false;
     }
     factura.AdaugaPlata(plata);
     var result = factura.AchitareFactura();
     MessageBox.Show(String.Format("Plata inregistrata pentru factura cu seria '{0}' si 'numarul'", factura.Serie, factura.Numar));
     if (result.Status == GestiuneBusiness.Enums.StatusEnum.Saved)
     {
         sumaDisponibila = sumaDisponibila - sumaDePlatit;
         if (sumaDisponibila == 0)
         {
             nrTbox.Text = string.Empty;
             serieTbox.Text = string.Empty;
             sumaDisponibilaTbox.Text = string.Empty;
         }
         RefreshFacturileMele();
     }
     else
     {
         MessageBox.Show(String.Format("Plata pentru factura cu seria '{0}' si numarul '{1}' nu a fost efectuata cu succes, suma nu a fost retrasa", factura.Serie, factura.Numar));
     }
     sumaDisponibilaTbox.Enabled = sumaDisponibila == 0m;
     nrTbox.Enabled = sumaDisponibilaTbox.Enabled;
     serieTbox.Enabled = sumaDisponibilaTbox.Enabled;
     return true;
 }