Esempio n. 1
0
        public void PretraziHandler(object sender, EventArgs e)
        {
            System.Drawing.Point point    = new System.Drawing.Point(Cursor.Position.X, Cursor.Position.Y);
            UltraGrid            dataGrid = new UltraGrid();

            dataGrid = this.userControlDataGridKONTO.DataGrid;
            ExtendedWindowSmartPartInfo smartPartInfo = new ExtendedWindowSmartPartInfo {
                StartPosition = FormStartPosition.CenterParent,
                Modal         = true,
                ControlBox    = false,
                Title         = "Unesite tekst za pretraživanje",
                Icon          = ImageResourcesNew.mbs
            };
            ExtendedWindowWorkspace workspace = new ExtendedWindowWorkspace();
            UnosPojma smartPart = this.Controller.WorkItem.Items.AddNew <UnosPojma>();

            workspace.Show(smartPart, smartPartInfo);
            if (smartPart.ParentForm.DialogResult == DialogResult.OK)
            {
                ColumnEnumerator enumerator = dataGrid.DisplayLayout.Bands[0].Columns.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    if (enumerator.Current.DataType.ToString() == "System.String")
                    {
                        dataGrid.DisplayLayout.Bands[0].ColumnFilters["IDKONTO"].FilterConditions.Add(FilterComparisionOperator.Contains, smartPart.UneseniString);
                    }
                }
            }
        }
Esempio n. 2
0
        public void KontirajHandler(object sender, EventArgs e)
        {
            SHEMADDDataAdapter  adapter  = new SHEMADDDataAdapter();
            SHEMADDDataSet      dataSet  = new SHEMADDDataSet();
            GKSTAVKADataSet     set2     = new GKSTAVKADataSet();
            GKSTAVKADataAdapter adapter3 = new GKSTAVKADataAdapter();
            int num = Conversions.ToInteger(Operators.AddObject(this.NUMERACIJA(), 1));
            SHEMADDSelectionListWorkItem item = this.Controller.WorkItem.Items.AddNew <SHEMADDSelectionListWorkItem>("test");
            DataRow row3 = item.ShowModal(true, "", null);

            item.Terminate();
            if (row3 != null)
            {
                DataRow     row2;
                DataRow     current;
                IEnumerator enumerator = null;
                this.OPIS = "test";
                this.OPIS = this.m_opisobracuna + " " + this.MJESECOBRACUNA + "/" + this.GODINAOBRACUNA + " šifra obr. " + this.m_idobracun;
                adapter.FillByIDSHEMADD(dataSet, Conversions.ToInteger(row3["idshemadd"]));
                decimal num2 = Conversions.ToDecimal(this.DsTotaliUstanove1.Tables[1].Rows[0]["uKUPNOBRUTO"]);
                if (dataSet.SHEMADDSHEMADDSTANDARD.Select("idddvrsteiznosa=8").Length > 0)
                {
                    row2 = set2.GKSTAVKA.NewRow();
                    row2["datumdokumenta"] = DateAndTime.Today;
                    row2["brojdokumenta"]  = num;
                    row2["brojstavke"]     = 1;
                    row2["iddokument"]     = 0x3e6;
                    row2["OPIS"]           = this.OPIS;
                    row2["zatvoreniiznos"] = 0;
                    row2["statusgk"]       = 0;
                    row2["IDKONTO"]        = RuntimeHelpers.GetObjectValue(dataSet.SHEMADDSHEMADDSTANDARD.Select("idddvrsteiznosa=8")[0]["KONTODDVRSTAIZNOSAIDKONTO"]);
                    row2["IDMJESTOTROSKA"] = RuntimeHelpers.GetObjectValue(dataSet.SHEMADDSHEMADDSTANDARD.Select("idddvrsteiznosa=8")[0]["MTDDVRSTAIZNOSAIDMJESTOTROSKA"]);
                    row2["IDORGJED"]       = RuntimeHelpers.GetObjectValue(dataSet.SHEMADD.Rows[0]["SHEMADDOJIDORGJED"]);
                    row2["GKGODIDGODINE"]  = mipsed.application.framework.Application.ActiveYear;
                    if (Operators.ConditionalCompareObjectEqual(dataSet.SHEMADDSHEMADDSTANDARD.Select("idddvrsteiznosa=8")[0]["STRANEDDVRSTEIZNOSAIDSTRANEKNJIZENJA"], 1, false))
                    {
                        row2["duguje"]    = RuntimeHelpers.GetObjectValue(this.DsTotaliUstanove1.Tables[1].Rows[0]["uKUPNOBRUTO"]);
                        row2["potrazuje"] = 0;
                    }
                    else
                    {
                        row2["potrazuje"] = RuntimeHelpers.GetObjectValue(this.DsTotaliUstanove1.Tables[1].Rows[0]["uKUPNOBRUTO"]);
                        row2["duguje"]    = 0;
                    }
                    set2.GKSTAVKA.Rows.Add(row2);
                }
                S_DD_REKAP_DOPRINOSDataAdapter adapter2 = new S_DD_REKAP_DOPRINOSDataAdapter();
                S_DD_REKAP_DOPRINOSDataSet     set3     = new S_DD_REKAP_DOPRINOSDataSet();
                adapter2.Fill(set3, this.m_idobracun);
                try
                {
                    enumerator = dataSet.SHEMADDSHEMADDDOPRINOS.Rows.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        current = (DataRow)enumerator.Current;
                        if (set3.S_DD_REKAP_DOPRINOS.Select(Conversions.ToString(Operators.ConcatenateObject("sifra = ", current["SHEMADDDOPRINOSIDDOPRINOS"]))).Length > 0)
                        {
                            row2 = set2.GKSTAVKA.NewRow();
                            row2["datumdokumenta"] = DateAndTime.Today;
                            row2["brojdokumenta"]  = num;
                            row2["brojstavke"]     = 1;
                            row2["iddokument"]     = 0x3e6;
                            row2["OPIS"]           = this.OPIS;
                            row2["zatvoreniiznos"] = 0;
                            row2["statusgk"]       = 0;
                            row2["IDKONTO"]        = RuntimeHelpers.GetObjectValue(current["KONTODOPIDKONTO"]);
                            row2["IDMJESTOTROSKA"] = RuntimeHelpers.GetObjectValue(current["MTDOPIDMJESTOTROSKA"]);
                            row2["IDORGJED"]       = RuntimeHelpers.GetObjectValue(dataSet.SHEMADD.Rows[0]["SHEMADDOJIDORGJED"]);
                            row2["GKGODIDGODINE"]  = mipsed.application.framework.Application.ActiveYear;
                            if (Operators.ConditionalCompareObjectEqual(current["STRANEDOPIDSTRANEKNJIZENJA"], 1, false))
                            {
                                row2["duguje"]    = RuntimeHelpers.GetObjectValue(set3.S_DD_REKAP_DOPRINOS.Select(Conversions.ToString(Operators.ConcatenateObject("sifra = ", current["SHEMADDDOPRINOSIDDOPRINOS"])))[0]["iznos"]);
                                row2["potrazuje"] = 0;
                            }
                            else
                            {
                                row2["potrazuje"] = RuntimeHelpers.GetObjectValue(set3.S_DD_REKAP_DOPRINOS.Select(Conversions.ToString(Operators.ConcatenateObject("sifra = ", current["SHEMADDDOPRINOSIDDOPRINOS"])))[0]["iznos"]);
                                row2["duguje"]    = 0;
                            }
                            set2.GKSTAVKA.Rows.Add(row2);
                        }
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
                foreach (DataRow row in dataSet.SHEMADDSHEMADDSTANDARD.Select("idddvrsteiznosa=9"))
                {
                    row2 = set2.GKSTAVKA.NewRow();
                    row2["datumdokumenta"] = DateAndTime.Today;
                    row2["brojdokumenta"]  = num;
                    row2["brojstavke"]     = 1;
                    row2["iddokument"]     = 0x3e6;
                    row2["OPIS"]           = this.OPIS;
                    row2["zatvoreniiznos"] = 0;
                    row2["statusgk"]       = 0;
                    row2["IDKONTO"]        = RuntimeHelpers.GetObjectValue(row["KONTODDVRSTAIZNOSAIDKONTO"]);
                    row2["IDMJESTOTROSKA"] = RuntimeHelpers.GetObjectValue(row["MTDDVRSTAIZNOSAIDMJESTOTROSKA"]);
                    row2["IDORGJED"]       = RuntimeHelpers.GetObjectValue(dataSet.SHEMADD.Rows[0]["SHEMADDOJIDORGJED"]);
                    row2["GKGODIDGODINE"]  = mipsed.application.framework.Application.ActiveYear;
                    if (Operators.ConditionalCompareObjectEqual(row["STRANEDDVRSTEIZNOSAIDSTRANEKNJIZENJA"], 1, false))
                    {
                        row2["duguje"]    = RuntimeHelpers.GetObjectValue(this.DsTotaliUstanove1.Tables[1].Rows[0]["ukupnoporez"]);
                        row2["potrazuje"] = 0;
                    }
                    else
                    {
                        row2["potrazuje"] = RuntimeHelpers.GetObjectValue(this.DsTotaliUstanove1.Tables[1].Rows[0]["ukupnoporez"]);
                        row2["duguje"]    = 0;
                    }
                    set2.GKSTAVKA.Rows.Add(row2);
                }
                foreach (DataRow row in dataSet.SHEMADDSHEMADDSTANDARD.Select("idddvrsteiznosa=10"))
                {
                    row2 = set2.GKSTAVKA.NewRow();
                    row2["datumdokumenta"] = DateAndTime.Today;
                    row2["brojdokumenta"]  = num;
                    row2["brojstavke"]     = 1;
                    row2["iddokument"]     = 0x3e6;
                    row2["OPIS"]           = this.OPIS;
                    row2["zatvoreniiznos"] = 0;
                    row2["statusgk"]       = 0;
                    row2["IDKONTO"]        = RuntimeHelpers.GetObjectValue(row["KONTODDVRSTAIZNOSAIDKONTO"]);
                    row2["IDMJESTOTROSKA"] = RuntimeHelpers.GetObjectValue(row["MTDDVRSTAIZNOSAIDMJESTOTROSKA"]);
                    row2["IDORGJED"]       = RuntimeHelpers.GetObjectValue(dataSet.SHEMADD.Rows[0]["SHEMADDOJIDORGJED"]);
                    row2["GKGODIDGODINE"]  = mipsed.application.framework.Application.ActiveYear;
                    if (Operators.ConditionalCompareObjectEqual(row["STRANEDDVRSTEIZNOSAIDSTRANEKNJIZENJA"], 1, false))
                    {
                        row2["duguje"]    = RuntimeHelpers.GetObjectValue(this.DsTotaliUstanove1.Tables[1].Rows[0]["ukupnoprirez"]);
                        row2["potrazuje"] = 0;
                    }
                    else
                    {
                        row2["potrazuje"] = RuntimeHelpers.GetObjectValue(this.DsTotaliUstanove1.Tables[1].Rows[0]["ukupnoprirez"]);
                        row2["duguje"]    = 0;
                    }
                    set2.GKSTAVKA.Rows.Add(row2);
                }
                foreach (DataRow row in dataSet.SHEMADDSHEMADDSTANDARD.Select("idddvrsteiznosa=11"))
                {
                    row2 = set2.GKSTAVKA.NewRow();
                    row2["datumdokumenta"] = DateAndTime.Today;
                    row2["brojdokumenta"]  = num;
                    row2["brojstavke"]     = 1;
                    row2["iddokument"]     = 0x3e6;
                    row2["OPIS"]           = this.OPIS;
                    row2["zatvoreniiznos"] = 0;
                    row2["statusgk"]       = 0;
                    row2["IDKONTO"]        = RuntimeHelpers.GetObjectValue(row["KONTODDVRSTAIZNOSAIDKONTO"]);
                    row2["IDMJESTOTROSKA"] = RuntimeHelpers.GetObjectValue(row["MTDDVRSTAIZNOSAIDMJESTOTROSKA"]);
                    row2["IDORGJED"]       = RuntimeHelpers.GetObjectValue(dataSet.SHEMADD.Rows[0]["SHEMADDOJIDORGJED"]);
                    row2["GKGODIDGODINE"]  = mipsed.application.framework.Application.ActiveYear;
                    if (Operators.ConditionalCompareObjectEqual(row["STRANEDDVRSTEIZNOSAIDSTRANEKNJIZENJA"], 1, false))
                    {
                        row2["duguje"]    = RuntimeHelpers.GetObjectValue(this.DsTotaliUstanove1.Tables[1].Rows[0]["porezkrizni"]);
                        row2["potrazuje"] = 0;
                    }
                    else
                    {
                        row2["potrazuje"] = RuntimeHelpers.GetObjectValue(this.DsTotaliUstanove1.Tables[1].Rows[0]["porezkrizni"]);
                        row2["duguje"]    = 0;
                    }
                    set2.GKSTAVKA.Rows.Add(row2);
                }
                foreach (DataRow row in dataSet.SHEMADDSHEMADDSTANDARD.Select("idddvrsteiznosa=12"))
                {
                    row2 = set2.GKSTAVKA.NewRow();
                    row2["datumdokumenta"] = DateAndTime.Today;
                    row2["brojdokumenta"]  = num;
                    row2["brojstavke"]     = 1;
                    row2["iddokument"]     = 0x3e6;
                    row2["OPIS"]           = this.OPIS;
                    row2["zatvoreniiznos"] = 0;
                    row2["statusgk"]       = 0;
                    row2["IDKONTO"]        = RuntimeHelpers.GetObjectValue(row["KONTODDVRSTAIZNOSAIDKONTO"]);
                    row2["IDMJESTOTROSKA"] = RuntimeHelpers.GetObjectValue(row["MTDDVRSTAIZNOSAIDMJESTOTROSKA"]);
                    row2["IDORGJED"]       = RuntimeHelpers.GetObjectValue(dataSet.SHEMADD.Rows[0]["SHEMADDOJIDORGJED"]);
                    row2["GKGODIDGODINE"]  = mipsed.application.framework.Application.ActiveYear;
                    if (Operators.ConditionalCompareObjectEqual(row["STRANEDDVRSTEIZNOSAIDSTRANEKNJIZENJA"], 1, false))
                    {
                        row2["duguje"]    = Operators.SubtractObject(this.DsTotaliUstanove1.Tables[1].Rows[0]["netoplaca"], this.DsTotaliUstanove1.Tables[1].Rows[0]["porezkrizni"]);
                        row2["potrazuje"] = 0;
                    }
                    else
                    {
                        row2["potrazuje"] = Operators.SubtractObject(this.DsTotaliUstanove1.Tables[1].Rows[0]["netoplaca"], this.DsTotaliUstanove1.Tables[1].Rows[0]["porezkrizni"]);
                        row2["duguje"]    = 0;
                    }
                    set2.GKSTAVKA.Rows.Add(row2);
                }
                foreach (DataRow row in dataSet.SHEMADDSHEMADDSTANDARD.Select("idddvrsteiznosa=14"))
                {
                    row2 = set2.GKSTAVKA.NewRow();
                    row2["datumdokumenta"] = DateAndTime.Today;
                    row2["brojdokumenta"]  = num;
                    row2["brojstavke"]     = 1;
                    row2["iddokument"]     = 0x3e6;
                    row2["OPIS"]           = this.OPIS;
                    row2["zatvoreniiznos"] = 0;
                    row2["statusgk"]       = 0;
                    row2["IDKONTO"]        = RuntimeHelpers.GetObjectValue(row["KONTODDVRSTAIZNOSAIDKONTO"]);
                    row2["IDMJESTOTROSKA"] = RuntimeHelpers.GetObjectValue(row["MTDDVRSTAIZNOSAIDMJESTOTROSKA"]);
                    row2["IDORGJED"]       = RuntimeHelpers.GetObjectValue(dataSet.SHEMADD.Rows[0]["SHEMADDOJIDORGJED"]);
                    row2["GKGODIDGODINE"]  = mipsed.application.framework.Application.ActiveYear;
                    if (Operators.ConditionalCompareObjectEqual(row["STRANEDDVRSTEIZNOSAIDSTRANEKNJIZENJA"], 1, false))
                    {
                        row2["duguje"]    = Operators.AddObject(this.DsTotaliUstanove1.Tables[1].Rows[0]["uKUPNOBRUTO"], this.DsTotaliUstanove1.Tables[1].Rows[0]["ukupnodoprinosina"]);
                        row2["potrazuje"] = 0;
                    }
                    else
                    {
                        row2["potrazuje"] = Operators.AddObject(this.DsTotaliUstanove1.Tables[1].Rows[0]["uKUPNOBRUTO"], this.DsTotaliUstanove1.Tables[1].Rows[0]["ukupnodoprinosina"]);
                        row2["duguje"]    = 0;
                    }
                    set2.GKSTAVKA.Rows.Add(row2);
                }
                ExtendedWindowSmartPartInfo smartPartInfo = new ExtendedWindowSmartPartInfo {
                    StartPosition = FormStartPosition.CenterParent,
                    Modal         = true,
                    ControlBox    = false,
                    Title         = "Pretpregled temeljnice prije knjiženja",
                    Icon          = ImageResourcesNew.mbs
                };
                ExtendedWindowWorkspace workspace = new ExtendedWindowWorkspace();
                PregledTemeljnice       smartPart = this.Controller.WorkItem.Items.AddNew <PregledTemeljnice>();
                smartPart.GkstavkaDataSet1.Merge(set2);
                workspace.Show(smartPart, smartPartInfo);
                if (smartPart.ParentForm.DialogResult == DialogResult.OK)
                {
                    IEnumerator enumerator2 = null;
                    try
                    {
                        enumerator2 = set2.GKSTAVKA.GetEnumerator();
                        while (enumerator2.MoveNext())
                        {
                            current = (DataRow)enumerator2.Current;
                            current.BeginEdit();
                            current["datumdokumenta"] = RuntimeHelpers.GetObjectValue(smartPart.datumdok.Value);
                            current.EndEdit();
                        }
                    }
                    finally
                    {
                        if (enumerator2 is IDisposable)
                        {
                            (enumerator2 as IDisposable).Dispose();
                        }
                    }
                    adapter3.Update(set2);
                    Interaction.MsgBox("Knjiženje uspješno izvršeno. Kreiran je broj dokumenta: " + Conversions.ToString(num), MsgBoxStyle.Information, "MBS.Complete");
                }
            }
        }