Example #1
0
        private void RefreshFacturileMele()
        {
            facturaIntrareBindingSource.DataSource = null;
            var facturi = FacturaIntrare.GetAll().Where(p => p.SumaRamasaDePlatit > 0).ToList();

            facturaIntrareBindingSource.DataSource = facturi;
        }
        private void refreshBtn_Click(object sender, EventArgs e)
        {
            var raport = new DatoriiReport();

            raport.FacturiIntrareDataSource.DataSource = FacturaIntrare.GetAll().Where(p => p.SumaRamasaDePlatit > 0).ToList();
            reportViewer.Report = raport;
            reportViewer.RefreshReport();
        }
Example #3
0
        public void GetAllFacturaIntrareTest()
        {
            var target = FacturaIntrare.GetAll();

            if (target == null)
            {
                Assert.Fail();
            }
        }
Example #4
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);
        }
Example #5
0
        private void RefreshFacturiList(string filter = "")
        {
            facturiGrid.Rows.Clear();
            int index = 0;

            foreach (var item in FacturaIntrare.GetAll().Where(p => p.Contains(filter)))
            {
                facturiGrid.Rows.Add(item.Serie, item.Numar, item.Data.ToString("dd/MM/yyyy"), item.FirmaObject.Nume);
                facturiGrid.Rows[index++].Tag = item;
            }
        }
 private void AddEditFacturaIntrareForm_Load(object sender, EventArgs e)
 {
     if (FacturaIntrareObject == null)
     {
         this.Text            = "Adauga factura de intrare";
         FacturaIntrareObject = new FacturaIntrare();
     }
     else
     {
         this.Text = "Modifica factura de intrare";
         // load data
     }
 }
Example #7
0
 private void LoadData()
 {
     progressBar.Invoke(new UpdateDelegate(UpdateProgressBar));
     runningOperationLbl.Text = "Se incarca bancile...";
     Banca.GetAll();
     progressBar.Invoke(new UpdateDelegate(UpdateProgressBar));
     runningOperationLbl.Text = "Se incarca delegatii...";
     Delegat.GetAll();
     progressBar.Invoke(new UpdateDelegate(UpdateProgressBar));
     runningOperationLbl.Text = "Se incarca drepturile...";
     Drept.GetAll();
     progressBar.Invoke(new UpdateDelegate(UpdateProgressBar));
     runningOperationLbl.Text = "Se incarca facturile...";
     FacturaIntrare.GetAll();
     progressBar.Invoke(new UpdateDelegate(UpdateProgressBar));
     runningOperationLbl.Text = "Se incarca facturile...";
     FacturaIesire.GetAll();
     progressBar.Invoke(new UpdateDelegate(UpdateProgressBar));
     runningOperationLbl.Text = "Se incarca firmele...";
     Firma.GetAll();
     progressBar.Invoke(new UpdateDelegate(UpdateProgressBar));
     runningOperationLbl.Text = "Se incarca platile...";
     Plata.GetAll();
     progressBar.Invoke(new UpdateDelegate(UpdateProgressBar));
     runningOperationLbl.Text = "Se incarca platile...";
     PlataFactura.GetAll();
     progressBar.Invoke(new UpdateDelegate(UpdateProgressBar));
     runningOperationLbl.Text = "Se incarca platile...";
     PozitieFacturaIesire.GetAll();
     progressBar.Invoke(new UpdateDelegate(UpdateProgressBar));
     runningOperationLbl.Text = "Se incarca platile...";
     PozitieFacturaIntrare.GetAll();
     progressBar.Invoke(new UpdateDelegate(UpdateProgressBar));
     runningOperationLbl.Text = "Se incarca produsele...";
     Produs.GetAll();
     progressBar.Invoke(new UpdateDelegate(UpdateProgressBar));
     runningOperationLbl.Text = "Se incarca rolurile...";
     Rol.GetAll();
     progressBar.Invoke(new UpdateDelegate(UpdateProgressBar));
     runningOperationLbl.Text = "Se incarca platile...";
     RolDrept.GetAll();
     progressBar.Invoke(new UpdateDelegate(UpdateProgressBar));
     runningOperationLbl.Text = "Se incarca stocurile...";
     Stoc.GetAll();
     progressBar.Invoke(new UpdateDelegate(UpdateProgressBar));
     runningOperationLbl.Text = "Se incarca utilizatorii...";
     Utilizator.GetAll();
 }
Example #8
0
        public void InsertFacturaIntrareTest()
        {
            var target = new FacturaIntrare
            {
                Data    = DateTime.Now,
                IdFirma = 2,
                Numar   = "Testing",
                Serie   = "Testing"
            };
            var r = target.Save();

            if (r.Status == StatusEnum.Errors)
            {
                Assert.Fail();
            }
        }
Example #9
0
        public void UpdateFacturaIntrareTest()
        {
            var target = new FacturaIntrare
            {
                Data    = DateTime.Now,
                IdFirma = 1,
                Numar   = "Testing",
                Serie   = "TestingModificatIntrare",
                ID      = 1
            };
            var r = target.Save();

            if (r.Status == StatusEnum.Errors)
            {
                Assert.Fail();
            }
        }
Example #10
0
        public void SalvareFacturaIntrareCuPozitii()
        {
            FacturaIntrare target = new FacturaIntrare
            {
                CotaTva = 19.00m,
                IdFirma = 2,
                Numar   = "bla bla",
                Serie   = "bla bla 2",
                Data    = DateTime.Now
            };
            List <PozitieFacturaIntrare> pozitieFacturaIntrareList = new List <PozitieFacturaIntrare>();

            pozitieFacturaIntrareList.Add(new PozitieFacturaIntrare
            {
                Cantitate  = 10,
                IdProdus   = 1,
                PretUnitar = 123
            });
            pozitieFacturaIntrareList.Add(new PozitieFacturaIntrare
            {
                Cantitate  = 110,
                IdProdus   = 2,
                PretUnitar = 1223
            });
            pozitieFacturaIntrareList.Add(new PozitieFacturaIntrare
            {
                Cantitate  = 105,
                IdProdus   = 17,
                PretUnitar = 1236
            });
            pozitieFacturaIntrareList.Add(new PozitieFacturaIntrare
            {
                Cantitate  = 160,
                IdProdus   = 1,
                PretUnitar = 1623
            });
            PersistenceResult actual;

            actual = target.Save(pozitieFacturaIntrareList);
            if (actual.Status == StatusEnum.Errors)
            {
                Assert.Fail();
            }
        }
Example #11
0
 private void platesteAutomatBtn_Click(object sender, EventArgs e)
 {
     sumaPartialaTbox.Text = string.Empty;
     if (facturaIntrareBound == null)
     {
         return;
     }
     while (sumaDisponibila > 0) // ies daca nu mai am cu ce plati
     {
         var factura = FacturaIntrare.GetAll().OrderBy(p => p.Data).Where(p => p.SumaRamasaDePlatit > 0).FirstOrDefault();
         if (factura == null)
         {
             return;                  // ies daca nu mai gasesc facturi de platit
         }
         if (!PlatesteFactura(factura))
         {
             return;
         }
     }
 }