Exemple #1
0
        public void IspisOzn(object sender, EventArgs e)
        {
            if (ugdData.ActiveRow != null)
            {
                Dictionary <int, int> oznaceni = VratiOznaceneRacune(ugdData.Rows);

                if (oznaceni.Count > 0)
                {
                    BusinessLogic.Racuni objekt = new BusinessLogic.Racuni();

                    ReportDocument rpt = new ReportDocument();
                    rpt.Load(System.Windows.Forms.Application.StartupPath + @"\Izvjestaji\rptVirmaniUF.rpt");

                    // Set connection string from config in existing LogonProperties
                    rpt.DataSourceConnections[0].SetConnection(Mipsed7.Core.ApplicationDatabaseInformation.ServerName, Mipsed7.Core.ApplicationDatabaseInformation.DatabaseName, true);
                    rpt.DataSourceConnections[0].SetLogon(Mipsed7.Core.ApplicationDatabaseInformation.SqlUserName, Mipsed7.Core.ApplicationDatabaseInformation.SqlPassword);
                    rpt.DataSourceConnections[0].IntegratedSecurity = false;

                    rpt.SetDataSource(objekt.GetDataRacuni(oznaceni));

                    ExtendedWindowWorkspace workspace = new ExtendedWindowWorkspace();
                    PreviewReportWorkItem   item      = this.Controller.WorkItem.Items.Get <PreviewReportWorkItem>("Pregled");
                    if (item == null)
                    {
                        item = this.Controller.WorkItem.Items.AddNew <PreviewReportWorkItem>("Pregled");
                    }
                    item.Izvjestaj = rpt;
                    item.Activate();
                    item.Show(item.Workspaces["main"]);
                }
            }
        }
Exemple #2
0
        private bool SaveData()
        {
            lblValidationMessages.ResetText();

            StringBuilder message = ValidateDataInput();

            if (message.Length == 0)
            {
                using (BusinessLogic.Racuni objekt = new BusinessLogic.Racuni())
                {
                    objekt.pDatum       = udtDatum.DateTime;
                    objekt.pValuta      = udtValuta.DateTime;
                    objekt.pIDPartner   = (int)ucePartner.Value;
                    objekt.pModel       = uteModel.Value.ToString();
                    objekt.pPoziv       = utePoziv.Value.ToString();
                    objekt.pUkupanIznos = GetUkupanIznos(ugdStavke.Rows);

                    if (uteNapomena.Value != null)
                    {
                        objekt.pNapomena = uteNapomena.Value.ToString();
                    }

                    if (this.FormEditMode == Enums.FormEditMode.Update)
                    {
                        if (objekt.Update(message, objekt))
                        {
                            return(true);
                        }
                    }
                }
            }

            lblValidationMessages.Text = message.ToString();
            return(false);
        }
Exemple #3
0
 private object GetCijena(object proizvod)
 {
     using (BusinessLogic.Racuni objekt = new BusinessLogic.Racuni())
     {
         return(objekt.GetCijena(Convert.ToInt32(proizvod)));
     }
 }
Exemple #4
0
        private void FormLoad(object sender, EventArgs e)
        {
            BusinessLogic.Racuni.pRacuniStavke = new DataTable();
            BusinessLogic.Racuni.pRacuniStavke.Columns.Add("SEL", typeof(bool));
            BusinessLogic.Racuni.pRacuniStavke.Columns.Add("BROJSTAVKE", typeof(int));
            BusinessLogic.Racuni.pRacuniStavke.Columns.Add("IDPROIZVOD", typeof(int));
            BusinessLogic.Racuni.pRacuniStavke.Columns.Add("NAZIVPROIZVODRACUN", typeof(string));
            BusinessLogic.Racuni.pRacuniStavke.Columns.Add("CIJENARACUN", typeof(decimal));
            BusinessLogic.Racuni.pRacuniStavke.Columns.Add("RABAT", typeof(decimal));
            BusinessLogic.Racuni.pRacuniStavke.Columns.Add("KOLICNA", typeof(decimal));
            BusinessLogic.Racuni.pRacuniStavke.Columns.Add("FINPOREZSTOPARACUN", typeof(decimal));
            BusinessLogic.Racuni.pRacuniStavke.Columns.Add("CijenaPDV", typeof(decimal));

            BusinessLogic.Racuni.pRacuniStavke.PrimaryKey = new DataColumn[] { BusinessLogic.Racuni.pRacuniStavke.Columns["IDPROIZVOD"] };

            using (BusinessLogic.Racuni objekt = new BusinessLogic.Racuni())
            {
                LoadPartner(objekt);

                if (FormEditMode == Enums.FormEditMode.Update || FormEditMode == Enums.FormEditMode.Copy)
                {
                    LoadForm(objekt);
                }
            }
        }
Exemple #5
0
        public void PrijenosGKBroj(object sender, EventArgs e)
        {
            using (uscRacuniBroj objekt = new uscRacuniBroj(false))
            {
                if (objekt.ShowDialogForm("Prijenos") == DialogResult.OK)
                {
                    using (BusinessLogic.Racuni racun = new BusinessLogic.Racuni())
                    {
                        racun.pOdabraniRacuni = racun.VratiOznaceneRacunePoBroju(objekt.pyear, objekt.pod, objekt.pdo);

                        if (racun.pOdabraniRacuni.Count > 0)
                        {
                            if (racun.GetIDShema() != 0)
                            {
                                int id_shema = 0;
                                if (racun.InsertGlavnaKnjiga(ref id_shema))
                                {
                                    if (id_shema != 0)
                                    {
                                        MessageBox.Show("Uspješno je preneseno računa u GK: " + racun.pCounter);

                                        if (racun.InsertIRA())
                                        {
                                            MessageBox.Show("Uspješno je preneseno računa u IRA: " + racun.pCounter);

                                            racun.SetPreneseniObracuni();

                                            if (racun.SetZatvaranja())
                                            {
                                                LoadGridData();
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("Dogodila se greška prilikom financijskog zaduživanja!\nJavite se u T4S.");
                                }
                            }
                            else
                            {
                                MessageBox.Show("potrebno je napraviti shemu knjiženja\nda bi se računi mogli zadužiti.");
                            }
                        }
                    }
                }
            }
        }
Exemple #6
0
        private void LoadForm(BusinessLogic.Racuni objekt)
        {
            var selected = objekt.GetSelected();

            if (selected != null)
            {
                uteSifra.Value    = BusinessLogic.Racuni.pIDRacun.ToString() + "-" + BusinessLogic.Racuni.pIDGodina.ToString();
                udtDatum.Value    = Convert.ToDateTime(selected["DATUM"].ToString());
                udtValuta.Value   = Convert.ToDateTime(selected["VALUTA"].ToString());
                ucePartner.Value  = Convert.ToInt32(selected["IDPARTNER"].ToString());
                uteModel.Value    = selected["MODEL"].ToString();
                utePoziv.Value    = selected["POZIV"].ToString();
                uteNapomena.Value = selected["Napomena"].ToString();

                BusinessLogic.Racuni.pRacuniStavke = objekt.GetPostojeceStavke();

                BusinessLogic.Racuni.pRacuniStavke.PrimaryKey = new DataColumn[] { BusinessLogic.Racuni.pRacuniStavke.Columns["IDPROIZVOD"] };
                ugdStavke.DataSource = BusinessLogic.Racuni.pRacuniStavke;
                ugdStavke.DataBind();

                Utils.Tools.UltraGridStyling(ugdStavke);

                if (ugdStavke.DisplayLayout.Bands.Count > 0)
                {
                    ugdStavke.DisplayLayout.Bands[0].Columns["SEL"].Style          = Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBox;
                    ugdStavke.DisplayLayout.Bands[0].Columns["SEL"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;

                    ugdStavke.DisplayLayout.Bands[0].Columns["IDPROIZVOD"].Hidden         = true;
                    ugdStavke.DisplayLayout.Bands[0].Columns["BROJSTAVKE"].Hidden         = true;
                    ugdStavke.DisplayLayout.Bands[0].Columns["CIJENARACUN"].Format        = "N2";
                    ugdStavke.DisplayLayout.Bands[0].Columns["RABAT"].Format              = "N2";
                    ugdStavke.DisplayLayout.Bands[0].Columns["KOLICINA"].Format           = "N2";
                    ugdStavke.DisplayLayout.Bands[0].Columns["FINPOREZSTOPARACUN"].Format = "N2";
                    ugdStavke.DisplayLayout.Bands[0].Columns["CijenaPDV"].Format          = "N2";
                }

                if (BusinessLogic.Racuni.pRacuniStavke.Rows.Count == 0)
                {
                    btnBrisiStavku.Enabled = false;
                    btnUrediStavku.Enabled = false;
                }
                else
                {
                    btnBrisiStavku.Enabled = true;
                    btnUrediStavku.Enabled = true;
                }
            }
        }
Exemple #7
0
        private void FormLoad(object sender, EventArgs e)
        {
            using (BusinessLogic.Racuni objekt = new BusinessLogic.Racuni())
            {
                LoadProizvod(objekt);

                if (FormEditMode == Enums.FormEditMode.Update || FormEditMode == Enums.FormEditMode.Copy)
                {
                    uceProizvod.Value      = pIDProizvod;
                    uteNazivProizvod.Value = pNazivPriozvod;
                    uneCijena.Value        = pCijena;
                    uneRabat.Value         = pRabat;
                    uneKolicina.Value      = pKolicina;
                    uneStopa.Value         = pPorez;
                    uneUkupnaCijena.Value  = pCijenaPDV;
                }
            }
        }
Exemple #8
0
 private void LoadProizvod(BusinessLogic.Racuni objekt)
 {
     uceProizvod.DataSource = objekt.GetProizvod();
     uceProizvod.DataBind();
 }
Exemple #9
0
 private void LoadPartner(BusinessLogic.Racuni objekt)
 {
     ucePartner.DataSource = objekt.GetPartner();
     ucePartner.DataBind();
 }