示例#1
0
        // Rowデータの設定
        override protected void SetRowDataSub(models.db.Row row_data)
        {
            int torihikiKubunId = (int)row_data.GetLong("torihiki_kubun", -1);

            lblId.Text = row_data.GetStr("id", "(新規)");
            {
                DateTime?createdAt = row_data.GetDate("created_at");
                lblCreateDate.Text = createdAt != null?helper.Converter.DateTimeToWarekiStr(createdAt.Value) : "";
            }
            {
                DateTime?updatedAt = row_data.GetDate("updated_at");
                lblUpdateDate.Text = updatedAt != null?helper.Converter.DateTimeToWarekiStr(updatedAt.Value) : "";
            }
            txtDenpyouBangou.Text       = row_data.GetStr("denpyou_bangou_cache", "");
            txtKihyoubiGengou.Text      = row_data.GetStr("kihyoubi_gengou", "");
            txtKihyoubiYear.Text        = row_data.GetStr("kihyoubi_year", "");
            txtKihyoubiMonth.Text       = row_data.GetStr("kihyoubi_month", "");
            txtKihyoubiDay.Text         = row_data.GetStr("kihyoubi_day", "");
            txtKarikataKamokuCode.Text  = row_data.GetStr("karikata_kamoku_code", "");
            lblKarikataKamoku.Text      = db.MTKanjouKamoku.GetKamokuStr((int)row_data.GetLong("karikata_kamoku_id", -1), torihikiKubunId);
            txtKashikataKamokuCode.Text = row_data.GetStr("kashikata_kamoku_code", "");
            lblKashikataKamoku.Text     = db.MTKanjouKamoku.GetKamokuStr((int)row_data.GetLong("kashikata_kamoku_id", -1), torihikiKubunId);
            txtKingaku.AmountStr        = row_data.GetStr("karikata_kingaku", "");
            txtTekiyou.Text             = row_data.GetStr("tekiyou_id", "");
            txtComment.Text             = row_data.GetStr("comment", "");
            chkKessanSyuuryou.Checked   = row_data.GetBool("kessan_syuuryou", false);
            chkDenpyouKakunin.Checked   = row_data.GetBool("denpyou_kakunin", false);
            cmbKaikeiKubun.SelectRowByKeyValue(row_data.GetLong("kaikei_kubun", -1));
            cmbTorihikiKubun.SelectRowByKeyValue(torihikiKubunId);
            txtKarikataHojoSeiri.Text  = row_data.GetStr("karikata_hojo_seiri", "");
            lblKarikataHojo.Text       = db.MTKanjouKamoku.GetKamokuStr((int)row_data.GetLong("karikata_hojo_id", -1), torihikiKubunId);
            txtKashikataHojoSeiri.Text = row_data.GetStr("kashikata_hojo_seiri", "");
            lblKashikataHojo.Text      = db.MTKanjouKamoku.GetKamokuStr((int)row_data.GetLong("kashikata_hojo_id", -1), torihikiKubunId);

            bool isBindedShikinDenpyou = db.KaikeiDenpyouMeisai.IsAutoInsertedShikinDenpyouRow(row_data);

            txtKihyoubiGengou.ReadOnly      = isBindedShikinDenpyou;
            txtKihyoubiYear.ReadOnly        = isBindedShikinDenpyou;
            txtKihyoubiMonth.ReadOnly       = isBindedShikinDenpyou;
            txtKihyoubiDay.ReadOnly         = isBindedShikinDenpyou;
            cmbKaikeiKubun.Enabled          = !isBindedShikinDenpyou;
            cmbTorihikiKubun.Enabled        = !isBindedShikinDenpyou;
            txtKarikataKamokuCode.ReadOnly  = isBindedShikinDenpyou;
            txtKarikataHojoSeiri.ReadOnly   = isBindedShikinDenpyou;
            txtKashikataKamokuCode.ReadOnly = isBindedShikinDenpyou;
            txtKashikataHojoSeiri.ReadOnly  = isBindedShikinDenpyou;
            txtKingaku.ReadOnly             = isBindedShikinDenpyou;
            txtTekiyou.ReadOnly             = isBindedShikinDenpyou;
            txtComment.ReadOnly             = isBindedShikinDenpyou;
            btnRemoveRow.Enabled            = !isBindedShikinDenpyou;
            chkKessanSyuuryou.Enabled       = !isBindedShikinDenpyou;
        }
示例#2
0
        private void DenpyouHakkouButtonClicked(object sender)
        {
            models.db.Row syoukyakuRow = (sender as views.grid.AbstractDBGridRow).RowData;
            if (syoukyakuRow == null)
            {
                return;
            }
            if (SelectedRowId == -1)
            {
                return;
            }
            syoukyakuRow.Table.SetColumnValue(syoukyakuRow, "denpyou_hakkou", true);
            (sender as views.grid.AbstractDBGridRow).SetRowData(syoukyakuRow, true);

            models.db.Row newRow = Context.KaikeiDatabase.KaikeiDenpyouMeisai.NewRow();
            //newRow.Table.SetColumnValue(newRow, "kaikei_tanni", (int)models.constants.MTKaikeiTanni.Hukushi);
            newRow.Table.SetColumnValue(newRow, "kaikei_kubun", selectedRow.GetLong("kaikei_kubun", -1));
            newRow.Table.SetColumnValue(newRow, "torihiki_kubun", (int)models.constants.MTTorihikiKubun.Jigyou);
            if (syoukyakuRow.GetDate("gensyoubi") != null)
            {
                DateTime?date = syoukyakuRow.GetDate("gensyoubi");
                Context.KaikeiDatabase.KaikeiDenpyouMeisai.SetKihyoubiAndDenpyouBangouCache(newRow, date.Value);
            }

            models.db.Row karikataKamokuRow = Context.KaikeiDatabase.MTKanjouKamoku.GetRowById((int)models.constants.MTKanjouKamoku.GenkaSyoukyakuhi);
            if (karikataKamokuRow != null)
            {
                newRow.Table.SetColumnValue(newRow, "karikata_kamoku_code", karikataKamokuRow.GetStr("kamoku_code"));
            }

            models.db.Row kashikataKamokuKubunRow = Context.KaikeiDatabase.MTKamokuKubun.GetRowById((int)selectedRow.GetLong("kamoku_kubun_id", -1));
            models.db.Row kashikataKamokuRow      = Context.KaikeiDatabase.MTKanjouKamoku.GetRowById((int)kashikataKamokuKubunRow.GetLong("kanjou_kamoku_id", -1));
            if (kashikataKamokuRow != null)
            {
                newRow.Table.SetColumnValue(newRow, "kashikata_kamoku_code", kashikataKamokuRow.GetStr("kamoku_code"));
            }

            newRow.Table.SetColumnValue(newRow, "karikata_kingaku", syoukyakuRow.GetLong("touki_genka_syoukyaku_kagaku", 0));
            newRow.Table.SetColumnValue(newRow, "comment", selectedRow.GetStr("shisan_meisyou"));

            newRow.Table.Insert(newRow);
            models.db.Row insertedRow = newRow.Table.LastInsertedRow();

            helper.MsgBox.Info(KaikeiSystemBody.Properties.Resources.MsgConfirmSyoukyakuMeisaiDenpyouHakkou);
            var denpyouPopupController = new popup.DenpyouInfoPopupController();

            denpyouPopupController.ShowPopupModal(popup, insertedRow, Context);
        }
示例#3
0
        public static bool CheckKihyoubiIsInLisenceDate(models.db.KaikeiDatabase db, models.db.Row row)
        {
            DateTime?expireDate = db.MTResist.GetExpireDate();
            DateTime?kihyoubi   = row.GetDate("kihyoubi");

            if (expireDate == null)
            {
                return(false);
            }

            if (kihyoubi != null && kihyoubi > expireDate)
            {
                return(false);
            }

            return(true);
        }
示例#4
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   = "";
            }
示例#5
0
        private void OnChangeSyutokuNenngappi(models.db.Row row)
        {
            DateTime?date = row.GetDate("syutoku_nenngappi");
            DateTime gensyoubi;

            if (date == null)
            {
                gensyoubi = DateTime.Now;
            }
            else if (date.Value.Month > 3)
            {
                gensyoubi = new DateTime(date.Value.Year + 1, 3, 31);
            }
            else
            {
                gensyoubi = new DateTime(date.Value.Year, 3, 31);
            }
            row.Table.SetColumnValue(row, "gensyoubi", gensyoubi);

            OnChangeTaiyouNennsuu(row);
        }
示例#6
0
        // 年度起算日に入っているかチェック
        public static bool CheckKihyoubiIsInNendoKisanbi(models.db.KaikeiDatabase db, models.db.Row row)
        {
            if (!row.IsNull("kihyoubi"))
            {
                string kisanbiStr = db.MTSetting.GetStr("nenndo_kisanbi", "");
                if (helper.Converter.IsDateStr(kisanbiStr))
                {
                    DateTime dateStart = helper.Converter.DateStrToDateTime(kisanbiStr);
                    DateTime dateEnd   = dateStart.AddYears(1).AddDays(-1);
                    DateTime kihyoubi  = row.GetDate("kihyoubi").Value;

                    if (dateStart <= kihyoubi && kihyoubi <= dateEnd)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(false);
        }
示例#7
0
 // Rowデータの設定
 override protected void SetRowDataSub(models.db.Row rowData)
 {
     amountYobihi.AmountStr       = rowData.GetStr("yobihi");
     amountZenkiZandaka.AmountStr = rowData.GetStr("zenkimatsu_shiharai_shikin_zandaka");
     dateCreated.Date             = rowData.GetDate("create_date");
 }
 protected void SetRowDataToDateTimePicker(controls.NullableDateTimePicker control, models.db.Row rowData)
 {
     (control as controls.NullableDateTimePicker).Value = rowData.GetDate(control.Tag as string);
 }
 protected void SetRowDataToDateInputPanel(views.controls.DateInputPanel control, models.db.Row rowData)
 {
     control.Date = rowData.GetDate(control.Tag as string);
 }
示例#10
0
        // 償却
        public static bool CreateGenkaSyoukyakuMeisai(models.Context context, int koteiShisanId)
        {
            models.db.Row koteiShisanRow = context.KaikeiDatabase.MTKoteiShisan.GetRowById(koteiShisanId);

            if (koteiShisanRow == null)
            {
                return(false);
            }

            DateTime?syutokubi      = koteiShisanRow.GetDate("syutoku_nenngappi");
            long     syutokuKakaku  = koteiShisanRow.GetLong("syutoku_kakaku", -1);
            long     taiyouNensuu   = koteiShisanRow.GetLong("taiyou_nennsuu", -1);
            double   syoukyakuritsu = koteiShisanRow.GetDouble("syoukyaku_ritsu", -1);
            double   zanzonWariai   = koteiShisanRow.GetDouble("zanzon_wariai", -1);

            if (syutokubi == null || syutokuKakaku < 0 || taiyouNensuu < 0 || syoukyakuritsu < 0 || zanzonWariai < 0)
            {
                return(false);
            }

            long zanzonKagaku = (long)Math.Round(syutokuKakaku * zanzonWariai / 100);

            DateTime gensyoubi            = helper.Converter.DateTimeToNenndoKimatsubi(syutokubi.Value);
            long     ruikeiSyoukyakuhi    = 0;
            long     ruikeiShiyouTsukisuu = 0;
            long     kaisuu = 1;

            while (ruikeiShiyouTsukisuu < taiyouNensuu * 12)
            {
                long shiyouTsukisuu;
                if (ruikeiShiyouTsukisuu == 0)
                {
                    shiyouTsukisuu = syutokubi.Value.Month >= 4 ? 15 - syutokubi.Value.Month : 3 - syutokubi.Value.Month;
                    if (context.Setting.GetInt("kounyuutsuki_syoukyaku", 0) != 0)
                    {
                        shiyouTsukisuu++;
                    }
                    if (shiyouTsukisuu == 0)
                    {
                        gensyoubi      = gensyoubi.AddYears(1);
                        shiyouTsukisuu = 12;
                    }
                }
                else if (taiyouNensuu * 12 - ruikeiShiyouTsukisuu < 12)
                {
                    shiyouTsukisuu = taiyouNensuu * 12 - ruikeiShiyouTsukisuu;
                }
                else
                {
                    shiyouTsukisuu = 12;
                }

                long syoukyakuhi       = TeigakuhouGenkaSyoukyakuhi(syutokuKakaku, zanzonWariai, shiyouTsukisuu, syoukyakuritsu);
                long kisyuTyouboKagaku = syutokuKakaku - ruikeiSyoukyakuhi;
                ruikeiShiyouTsukisuu += shiyouTsukisuu;

                if (kisyuTyouboKagaku - syoukyakuhi < zanzonKagaku)     // 償却残額が残存価額を下回る
                {
                    syoukyakuhi        = kisyuTyouboKagaku - zanzonKagaku;
                    ruikeiSyoukyakuhi += syoukyakuhi;

                    insertMeisaiRow(context, koteiShisanId, kaisuu, shiyouTsukisuu, syoukyakuhi, gensyoubi,
                                    kisyuTyouboKagaku, ruikeiSyoukyakuhi);

                    break;
                }

                if (ruikeiShiyouTsukisuu == taiyouNensuu * 12 &&     // 最終年
                    kisyuTyouboKagaku - syoukyakuhi != zanzonKagaku) // 残存価額の調整が必要
                {
                    if (shiyouTsukisuu == 12)                        // 年跨ぎ
                    {
                        ruikeiSyoukyakuhi += syoukyakuhi;

                        insertMeisaiRow(context, koteiShisanId, kaisuu, shiyouTsukisuu, syoukyakuhi, gensyoubi,
                                        kisyuTyouboKagaku, ruikeiSyoukyakuhi);

                        shiyouTsukisuu = 1;
                        kaisuu++;
                        gensyoubi          = gensyoubi.AddYears(1);
                        kisyuTyouboKagaku  = kisyuTyouboKagaku - syoukyakuhi;
                        syoukyakuhi        = kisyuTyouboKagaku - zanzonKagaku;
                        ruikeiSyoukyakuhi += syoukyakuhi;

                        insertMeisaiRow(context, koteiShisanId, kaisuu, shiyouTsukisuu, syoukyakuhi, gensyoubi,
                                        kisyuTyouboKagaku, ruikeiSyoukyakuhi);
                    }
                    else
                    {
                        shiyouTsukisuu    += 1;
                        syoukyakuhi        = kisyuTyouboKagaku - zanzonKagaku;
                        ruikeiSyoukyakuhi += syoukyakuhi;

                        insertMeisaiRow(context, koteiShisanId, kaisuu, shiyouTsukisuu, syoukyakuhi, gensyoubi,
                                        kisyuTyouboKagaku, ruikeiSyoukyakuhi);
                    }
                }
                else
                {
                    ruikeiSyoukyakuhi += syoukyakuhi;

                    insertMeisaiRow(context, koteiShisanId, kaisuu, shiyouTsukisuu, syoukyakuhi, gensyoubi,
                                    kisyuTyouboKagaku, ruikeiSyoukyakuhi);
                }

                kaisuu++;
                gensyoubi = gensyoubi.AddYears(1);
            }

            return(true);
        }