Exemplo n.º 1
0
        private void ReadTyuukiTanpo(int tyuukiId)
        {
            foreach (var row in db.Tyuuki8.Select("where tyuuki_id=" + tyuukiId))
            {
                string        name           = "";
                models.db.Row kamokuKubunRow = db.MTKamokuKubun.GetRowById((int)row.GetLong("kamoku_kubun_id", -1));
                if (kamokuKubunRow != null)
                {
                    name += kamokuKubunRow.GetStr("name");
                    models.db.Row parent = db.MTKamokuKubun.GetParentOf(kamokuKubunRow);
                    if (parent != null)
                    {
                        if (parent.GetId() == (int)models.constants.MTKamokuKubun.KoteiShisanKihonZaisan)
                        {
                            name += "(基本財産)";
                        }
                        if (parent.GetId() == (int)models.constants.MTKamokuKubun.KoteiShisanSonota)
                        {
                            name += "(その他の固定資産)";
                        }
                    }
                }

                TanpoRow tanpoRow = new TanpoRow((int)row.GetLong("tanpo_kubun_id", -1), name, row.GetLong("amount", 0));
                tanpoKubunRows.Add(tanpoRow);
            }
        }
Exemplo n.º 2
0
        private void InitTableAddRow(models.db.Row kamokuKubunRow)
        {
            int             kamokuKubunId = kamokuKubunRow.GetId();
            int             parentId      = (int)kamokuKubunRow.GetLong("parent_id", -1);
            string          parentName;
            KoteiShisanType type;

            if (parentId == (int)models.constants.MTKamokuKubun.KoteiShisanKihonZaisan)
            {
                parentName = KaikeiSystemBody.Properties.Resources.CaptionKihonZaisanYuukei;
                type       = KoteiShisanType.KihonZaisan;
            }
            else if (models.KoteiShisanFunc.IsSonotaYuukeiKoteiShisan(kamokuKubunId))
            {
                parentName = Properties.Resources.CaptionSonotaKoteishisanYuukei;
                type       = KoteiShisanType.SonotaYuukei;
            }
            else
            {
                parentName = Properties.Resources.CaptionSonotaKoteishisanMukei;
                type       = KoteiShisanType.SonotaMukei;
            }
            MeisaiRow row = new MeisaiRow(kamokuKubunRow.GetStr("name"), parentName, type);

            meisaiTable.Add(kamokuKubunRow.GetId(), row);
            meisaiList.Add(row);
        }
        private void AddKamokuRow(models.db.Row daikubunRow, models.db.Row kamokuKubunRow, int groupId)
        {
            int kamokuKubunId = (int)kamokuKubunRow.GetId();

            models.db.Row kanjouKamokuRow = db.MTKanjouKamoku.GetFirstRow("where id=" + kamokuKubunRow.GetLong("kanjou_kamoku_id", -1));
            if (kanjouKamokuRow == null)
            {
                return;
            }
            if (kanjouKamokuRow.GetBool("usable", false) == false)
            {
                return;
            }

            int taisyakuKubunId = (int)kanjouKamokuRow.GetLong("taisyaku_kubun_id", -1);

            if ((taisyakuKubunId == (int)models.constants.MTTaisyakuKubun.KariPlus || taisyakuKubunId == (int)models.constants.MTTaisyakuKubun.KariMinus) &&
                groupId == GroupIdSyuunyuu)
            {
                return;
            }
            if ((taisyakuKubunId == (int)models.constants.MTTaisyakuKubun.KashiPlus || taisyakuKubunId == (int)models.constants.MTTaisyakuKubun.KashiMinus) &&
                groupId == GroupIdShisyutsu)
            {
                return;
            }

            if (kanjouKamokuHash.ContainsKey(kanjouKamokuRow.GetId()))
            {
                return;
            }
            kanjouKamokuHash.Add(kanjouKamokuRow.GetId(), true);

            ShisanRow shisanRow = new ShisanRow();

            shisanRow.GroupId        = groupId;
            shisanRow.KanjouKamokuId = kanjouKamokuRow.GetId();
            //shisanRow.KamokuKubunId = kamokuRow.GetId();
            shisanRow.DaikubunId            = daikubunRow.GetId();
            shisanRow.TaisyakuKubun         = taisyakuKubunId;
            shisanRow.IsShikinKamoku        = (kanjouKamokuRow.GetLong("shikin_kamoku_kubun_id", -1) != -1) || (kanjouKamokuRow.GetLong("taisyaku_kamoku_kubun_id", -1) != -1);
            shisanRow.IsJigyouKamoku        = kanjouKamokuRow.GetLong("jigyou_kamoku_kubun_id", -1) != -1 || (kanjouKamokuRow.GetLong("taisyaku_kamoku_kubun_id", -1) != -1);
            shisanRow.KanjouKamokuHierarchy = (int)kanjouKamokuRow.GetLong("hierarchy", -1);
            RowList.Add(shisanRow);

            if (kamokuKubunId == (int)models.constants.MTKamokuKubun.JikiKurikoshikatsudouZougenSagakuChukubun)
            {
                jikiKurikoshiIndex = RowList.Count - 1;
            }
        }
Exemplo n.º 4
0
        private void DetailRowDeleteButtonClicked()
        {
            if (bufferedHojoKamokuTable.RowCount("") > 0)
            {
                helper.MsgBox.Err(KaikeiSystemBody.Properties.Resources.MsgDeleteHojoKamoku);
                return;
            }

            var res = System.Windows.Forms.MessageBox.Show(KaikeiSystemBody.Properties.Resources.MsgConfirmToDeleteRow,
                                                           KaikeiSystemBody.Properties.Resources.CaptionConfirm,
                                                           System.Windows.Forms.MessageBoxButtons.OKCancel,
                                                           System.Windows.Forms.MessageBoxIcon.Warning);

            if (res == System.Windows.Forms.DialogResult.OK)
            {
                if (Context.KaikeiDatabase.KaikeiDenpyouMeisai.IsUsedKanjouKamoku(kanjouKamokuRow.GetId()))
                {
                    helper.MsgBox.Err(Properties.Resources.MsgUsedKamokuCanNotDelete);
                }
                else if (bufferedKanjouKamokuTable.Delete(kanjouKamokuRow))
                {
                }
                else
                {
                    helper.MsgBox.ShowMsg("DB error", "err");
                }
                popup.Close();
            }
        }
Exemplo n.º 5
0
        public void Calc(int nenndo, int kaikeiKubun)
        {
            KaikeiKubun = kaikeiKubun == -1 ? db.MTKaikeiKubun.RootNodeId : kaikeiKubun;
            Nenndo      = nenndo;

            GenkaSyoukyakuRuikeiGaku = 0;
            TyousyuuHunouKin         = 0;
            Tyuuki2     = "";
            Tyuuki6     = "";
            Tyuuki1Rows = new List <BalanceSheetTyuuki1Row>();
            Tyuuki3Rows = new List <BalanceSheetTyuuki3Row>();
            Tyuuki4Rows = new List <BalanceSheetTyuuki4Row>();
            Tyuuki5Rows = new List <BalanceSheetTyuuki5Row>();

            models.db.Row row = db.TaisyakuTaisyouhyouTyuuki.GetFirstRow("where nenndo=" + Nenndo);

            if (row != null)
            {
                tyuukiId = row.GetId();
                Tyuuki2  = row.GetStr("juuyou_henkou");
                Tyuuki6  = row.GetStr("juuyou_kouhatsu");

                CalcKyakutyuu();
                CalcTyuuki1();
                CalcTyuuki3();
                CalcTyuuki4();
                CalcTyuuki5();
            }
        }
Exemplo n.º 6
0
        public void SetQuery(string query, int targetKaikeiKubunId, bool margeDenpyouGroup)
        {
            foreach (var row in db.KaikeiDenpyouMeisai.Select(query + " order by denpyou_bangou"))
            {
                int kaikeiKubunId = (int)row.GetLong("kaikei_kubun", -1);
                if (!db.MTKaikeiKubun.IsChildOf(kaikeiKubunId, targetKaikeiKubunId))
                {
                    continue;
                }

                if (denpyouIdHash.ContainsKey(row.GetId()))
                {
                    continue;
                }
                if (row.GetLong("parent_meisai_id", -1) != -1)
                {
                    continue;
                }

                ShiwakeDenpyouRow denpyouRow = new ShiwakeDenpyouRow(db, row);
                RowList.Add(denpyouRow);
                denpyouIdHash[row.GetId()] = true;

                models.db.Row nextRow = row.Table.GetFirstRow("where id = " + row.GetLong("meisai_group_next_id", -1));
                if (nextRow == null)
                {
                    continue;
                }
                if (denpyouIdHash.ContainsKey(nextRow.GetId()))
                {
                    continue;
                }

                if (margeDenpyouGroup)
                {
                    denpyouRow.SetAddedShiwake(db, nextRow);
                    denpyouIdHash[nextRow.GetId()] = true;
                }
                else
                {
                    RowList.Add(new ShiwakeDenpyouRow(db, nextRow));
                    denpyouIdHash[nextRow.GetId()] = true;
                }
            }
        }
Exemplo n.º 7
0
 public static bool IsKoteiShisanKanjouKamoku(models.db.KaikeiDatabase db, int kanjouKamokuId)
 {
     models.db.Row kamokuKubunRow = db.MTKanjouKamoku.GetKamokuKubunRow(kanjouKamokuId, models.constants.MTTorihikiKubun.Shikin);
     if (kamokuKubunRow == null)
     {
         return(false);
     }
     return(IsKoteiShisanKamokuKubun(db, kamokuKubunRow.GetId()));
 }
Exemplo n.º 8
0
        private SetNenndoResult SearchData(int year, int kaikeiKubun)
        {
            bool inserted = false;

            tyuukiRow = null;
            tyuukiId  = -1;
            form.SetTyuukiRow(tyuukiRow);

            if (Context.KaikeiDatabase.MTKaikeiKubun.GetRowById(kaikeiKubun) == null)
            {
                return(SetNenndoResult.Failed);
            }

            string sql = "where nenndo=" + year + " and kaikei_kubun_id=" + kaikeiKubun;

            var rows = Context.KaikeiDatabase.Tyuuki.Select(sql);

            if (rows.Count() == 0)
            {
                SetInitialData(year, kaikeiKubun);
                rows = Context.KaikeiDatabase.Tyuuki.Select(sql);
                if (rows.Count() == 0)
                {
                    return(SetNenndoResult.Failed);
                }
                inserted = true;
            }


            tyuukiRow = rows.First();
            tyuukiId  = tyuukiRow.GetId();
            form.SetTyuukiRow(tyuukiRow);

            string gridSql = "where tyuuki_id=" + tyuukiId;

            tyuuki8GridController.SetQuery(gridSql);
            tyuuki10GridController.SetQuery(gridSql);
            tyuuki11GridController.SetQuery(gridSql);

            if (inserted)
            {
                return(SetNenndoResult.Inserted);
            }
            else
            {
                return(SetNenndoResult.Searched);
            }
        }
Exemplo n.º 9
0
            public ShiwakeDenpyouRow(models.db.KaikeiDatabase db, models.db.Row row)
            {
                Id            = row.GetId();
                DenpyouBangou = row.GetStr("denpyou_bangou", "");
                KaikeiKubun   = row.GetMasterStr("kaikei_kubun", "name", "", db.MTKaikeiKubun);
                TorihikiKubun = row.GetMasterStr("torihiki_kubun", "torihiki_kubun", "", db.MTTorihikiKubun);

                Kihyoubi = row.GetDate("kihyoubi");

                int torihikiKubunId = (int)row.GetLong("torihiki_kubun", -1);

                KarikataKamoku  = db.MTKanjouKamoku.GetKamokuStr((int)row.GetLong("karikata_kamoku_id", -1), torihikiKubunId);
                KashikataKamoku = db.MTKanjouKamoku.GetKamokuStr((int)row.GetLong("kashikata_kamoku_id", -1), torihikiKubunId);
                KarikataHojo    = db.MTKanjouKamoku.GetKamokuStr((int)row.GetLong("karikata_hojo_id", -1), torihikiKubunId);
                KashikataHojo   = db.MTKanjouKamoku.GetKamokuStr((int)row.GetLong("kashikata_hojo_id", -1), torihikiKubunId);
                Tekiyou         = row.GetStr("comment");
                //Kingaku = helper.Converter.LongToAmount(row.GetLong("karikata_kingaku", 0));
                Kingaku = row.GetLong("karikata_kingaku", 0);

                KarikataKamokuCode = row.GetStr("karikata_kamoku_code");
                int karikataHojoSeiriLong = (int)row.GetLong("karikata_hojo_seiri", 0);

                KarikataHojoSeiri = (karikataHojoSeiriLong > 0) ? karikataHojoSeiriLong.ToString() : "";

                KashikataKamokuCode = row.GetStr("kashikata_kamoku_code");
                int kashikataHojoSeiriLong = (int)row.GetLong("kashikata_hojo_seiri", 0);

                KashikataHojoSeiri = (kashikataHojoSeiriLong > 0) ? kashikataHojoSeiriLong.ToString() : "";

                KarikataKamoku2  = "";
                KashikataKamoku2 = "";
                KarikataHojo2    = "";
                KashikataHojo2   = "";

                KarikataKamoku3  = "";
                KashikataKamoku3 = "";
                KarikataHojo3    = "";
                KashikataHojo3   = "";

                KarikataKamoku4  = "";
                KashikataKamoku4 = "";
                KarikataHojo4    = "";
                KashikataHojo4   = "";
            }
        private void CheckParentKubunYosan(models.db.Row row)
        {
            int    nenndo            = Context.Setting.GetDateTime("nenndo_kisanbi").Value.Year;
            int    parentKaikeiKubun = (int)row.GetLong("parent_id", -1);
            int    kaikeiKubun       = (int)row.GetId();
            string sql     = "where kaikei_kubun = " + parentKaikeiKubun + " and nenndo = " + nenndo;
            int    yosanCt = Context.KaikeiDatabase.YosanKamokuKubun.RowCount(sql);

            if (yosanCt == 0)
            {
                return;
            }

            helper.MsgBox.Warn(KaikeiSystemBody.Properties.Resources.MsgCheckParentKubunYosan);

            Context.KaikeiDatabase.BeginTransaction();
            foreach (var yosanRow in Context.KaikeiDatabase.YosanKamokuKubun.Select(sql))
            {
                yosanRow.Set("kaikei_kubun", kaikeiKubun);
                Context.KaikeiDatabase.YosanKamokuKubun.Update(yosanRow);
            }
            Context.KaikeiDatabase.CommitTransaction();
        }
        // Rowデータの設定
        override protected void SetRowDataSub(models.db.Row rowData)
        {
            models.db.Row kanjouKamokuRow = db.MTKanjouKamoku.GetRowFromKamokuKubun(rowData.GetLong("kamoku_kubun_id", -1));
            if (kanjouKamokuRow != null)
            {
                txtTaisyakuKubun.Text = kanjouKamokuRow.GetMasterStr("taisyaku_kubun_id", "caption", "", db.MTTaisyakuKubun);
            }
            else
            {
                txtTaisyakuKubun.Text = "";
                models.db.Row childKamokuKubunRow = db.MTKamokuKubun.GetFirstRow("where parent_id=" + rowData.GetLong("kamoku_kubun_id", -1));
                if (childKamokuKubunRow != null)
                {
                    models.db.Row childKanjouKamokuRow = db.MTKanjouKamoku.GetRowFromKamokuKubun(childKamokuKubunRow.GetId());
                    if (childKanjouKamokuRow != null)
                    {
                        txtTaisyakuKubun.Text = childKanjouKamokuRow.GetMasterStr("taisyaku_kubun_id", "caption", "", db.MTTaisyakuKubun);
                    }
                }
            }

            txtKamokuKubun.Text       = rowData.GetMasterStr("kamoku_kubun_id", "name", "", db.MTKamokuKubun);
            amountKurikoshi.AmountStr = rowData.GetStr("zenki_kurikoshi_gaku");
        }