Beispiel #1
0
        private void sp売上明細データ_CellEditEnding(object sender, SpreadCellEditEndingEventArgs e)
        {
            if (e.EditAction == SpreadEditAction.Cancel)
            {
                return;
            }
            CellName = e.CellPosition.ColumnName;
            CellText = sp売上明細データ.Cells[e.CellPosition.Row, e.CellPosition.Column].Text;

            Cell入出金金額 = AppCommon.DecimalParse(sp売上明細データ.Cells[e.CellPosition.Row, "入出金金額"].Text);

            //スプレッドコンボイベント関連付け解除
            if (sp売上明細データ[e.CellPosition].InheritedCellType is GrapeCity.Windows.SpreadGrid.ComboBoxCellType)
            {
                GrapeCity.Windows.SpreadGrid.Editors.GcComboBox gccmb = sp売上明細データ.EditElement as GrapeCity.Windows.SpreadGrid.Editors.GcComboBox;
                if (gccmb != null)
                {
                    gccmb.SelectionChanged -= comboEdit_SelectionChanged;
                }
            }

            if (sp売上明細データ[e.CellPosition].InheritedCellType is GrapeCity.Windows.SpreadGrid.CheckBoxCellType)
            {
                GrapeCity.Windows.SpreadGrid.Editors.CheckBoxEditElement gcchk = sp売上明細データ.EditElement as GrapeCity.Windows.SpreadGrid.Editors.CheckBoxEditElement;
                if (gcchk != null)
                {
                    gcchk.Checked   -= checkEdit_Checked;
                    gcchk.Unchecked -= checkEdit_Unchecked;
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 取得データの正常受信時のイベント
        /// </summary>
        /// <param name="message"></param>
        public override void OnReceivedResponseData(CommunicationObject message)
        {
            try
            {
                var       data = message.GetResultData();
                DataTable tbl  = (data is DataTable) ? (data as DataTable) : null;
                switch (message.GetMessageName())
                {
                case TargetTableNm:
                    if (tbl.Rows.Count == 0)
                    {
                        this.MaintenanceMode = AppConst.MAINTENANCEMODE_ADD;
                    }
                    else
                    {
                        //削除データ エラー処理
                        if (!string.IsNullOrEmpty(tbl.Rows[0]["削除日付"].ToString()))
                        {
                            this.ErrorMessage = "既に削除されているデータです。";
                            MessageBox.Show("既に削除されたデータです。");
                            ScreenClear();
                            return;
                        }

                        支払単価 = AppCommon.DecimalParse(tbl.Rows[0]["支払単価"].ToString());
                        計算区分 = tbl.Rows[0]["計算区分"].ToString();
                        this.MaintenanceMode = AppConst.MAINTENANCEMODE_EDIT;
                    }
                    //主キー変更不可
                    ChangeKeyItemChangeable(false);
                    BtnKakunin.IsEnabled = true;
                    SetFocusToTopControl();
                    break;

                //更新時処理
                case TargetTableNmUpdate:
                    //コントロール初期化
                    ScreenClear();
                    break;

                //削除時処理
                case TargetTableNmDelete:
                    //コントロール初期化
                    ScreenClear();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #3
0
        /// <summary>
        /// テーブルデータを各変数に代入
        /// </summary>
        /// <param name="tbl"></param>
        private void SetTblData(DataTable tbl)
        {
            string   Henkan;
            DateTime Wk;

            Henkan  = tbl.Rows[0]["得意先ID"].ToString();
            支払先KEY  = AppCommon.IntParse(Henkan);
            Henkan  = tbl.Rows[0]["適用開始年月日"].ToString();
            適用開始年月日 = DateTime.TryParse(Henkan, out Wk) ? Wk : DateTime.Today;
            Henkan  = tbl.Rows[0]["適用開始年月日"].ToString();
            適用開始年月日 = DateTime.TryParse(Henkan, out Wk) ? Wk : DateTime.Today;
            Henkan  = tbl.Rows[0]["燃料単価"].ToString();
            燃料単価    = AppCommon.DecimalParse(Henkan);
        }
Beispiel #4
0
        //データ受信メソッド
        private void StrData(DataTable tbl)
        {
            //表示データ
            MstData = tbl.Rows[0];
            G車種ID   = tbl.Rows[0]["G車種ID"].ToString();
            G車種名    = tbl.Rows[0]["G車種名"].ToString();
            略称名     = tbl.Rows[0]["略称名"].ToString();
            string henkan1 = tbl.Rows[0]["CO2排出係数1"].ToString();

            CO2排出係数1 = AppCommon.DecimalParse(henkan1);
            string henkan2 = tbl.Rows[0]["CO2排出係数2"].ToString();

            CO2排出係数2 = AppCommon.DecimalParse(henkan2);
            Combo事業用区分.SelectedIndex    = Convert.ToInt32(tbl.Rows[0]["事業用区分"].ToString());
            Comboディーゼル区分.SelectedIndex  = Convert.ToInt32(tbl.Rows[0]["ディーゼル区分"].ToString());
            Combo小型普通貨物区分.SelectedIndex = Convert.ToInt32(tbl.Rows[0]["小型普通区分"].ToString());
            Combo低公害者区分.SelectedIndex   = Convert.ToInt32(tbl.Rows[0]["低公害区分"].ToString());
        }
Beispiel #5
0
        // 合計計算
        void Summary()
        {
            合計金額 = 0m;

            if (sp売上明細データ.Columns[1].Name == null)
            {
                return;
            }

            DataTable 印刷データ = new DataTable("印刷データ");

            Dictionary <string, string> changecols = new Dictionary <string, string>()
            {
            };

            AppCommon.ConvertSpreadDataToTable <DLY16010_Member>(this.sp売上明細データ, 印刷データ, changecols);

            合計金額 = AppCommon.DecimalParse(印刷データ.Compute("Sum(入出金金額)", null).ToString());
        }
Beispiel #6
0
        private void sp売上明細データ_CellEditEnded(object sender, GrapeCity.Windows.SpreadGrid.SpreadCellEditEndedEventArgs e)
        {
            if (e.EditAction == SpreadEditAction.Cancel)
            {
                return;
            }
            var gcsp = (sender as GcSpreadGrid);

            if (gcsp == null)
            {
                return;
            }

            try
            {
                string cname = e.CellPosition.ColumnName;
                string ctext = sp売上明細データ.Cells[e.CellPosition.Row, e.CellPosition.Column].Text;
                ctext = ctext == null ? string.Empty : ctext;
                if (cname == CellName && ctext == CellText && (!(gcsp[e.CellPosition].InheritedCellType is GrapeCity.Windows.SpreadGrid.ComboBoxCellType) && !(gcsp[e.CellPosition].InheritedCellType is GrapeCity.Windows.SpreadGrid.CheckBoxCellType)))
                {
                    if (CloseFlg)
                    {
                        CloseFlg = false;
                    }
                    // セルの値が変化していなければ何もしない
                    return;
                }


                var    row = gcsp.Rows[e.CellPosition.Row];
                object val = row.Cells[e.CellPosition.Column].Value;
                val = val == null ? "" : val;
                if (cname.Contains("年月日") == true)
                {
                    AppCommon.SpreadYMDCellCheck(sender, e, this._originalText);
                    cname = cname.Replace("年月日", "日付");
                    DateTime dt;
                    if (DateTime.TryParse(row.Cells[e.CellPosition.Column].Text, out dt) == true)
                    {
                        val = dt;
                    }
                    else
                    {
                        this.ErrorMessage = "正しい日付を入力してください。";
                        return;
                    }
                }

                var colM = gcsp.Columns.Where(x => x.Name == "明細番号").FirstOrDefault();
                if (colM == null)
                {
                    throw new Exception("システムエラー");
                }
                var colL = gcsp.Columns.Where(x => x.Name == "明細行").FirstOrDefault();
                if (colL == null)
                {
                    throw new Exception("システムエラー");
                }

                base.SendRequest(new CommunicationObject(MessageType.UpdateData, DLY16010_UPDATE, row.Cells[colM.Index].Value, row.Cells[colL.Index].Value, e.CellPosition.ColumnName, val));


                合計金額 += AppCommon.DecimalParse(row.Cells[this.sp売上明細データ.Columns["入出金金額"].Index].Value.ToString()) - Cell入出金金額;

                //Button_Click_1(null , null);
            }
            catch (Exception ex)
            {
                this.ErrorMessage = "入力内容が不正です。";
            }
        }
Beispiel #7
0
        /// <summary>
        /// 画面初期化処理
        /// </summary>
        private void Keisan()
        {
            if (rowS01 == null || rowHendoData == null || rowJinkenData == null || rowKoteiData == null)
            {
                return;
            }

            //System.Windows.Forms.Application.DoEvents();

            小計B = 0;
            小計C = 0;
            小計D = 0;

            decimal dJyosu;

            小計B = rowHendoData.Select(q => q.金額).Sum();
            小計C = rowJinkenData.Select(q => q.金額).Sum();
            小計D = rowKoteiData.Select(q => q.金額).Sum();
            //小計D = rowKoteiData.Compute("sum(金額)", null) == null ? 0 : AppCommon.IntParse(rowKoteiData.Compute("sum(金額)", null).ToString());

            限界利益     = AppCommon.IntParse((rowS01["運送収入"] == null ? 0 : rowS01["運送収入"]).ToString()) - 小計B;
            乗務員直接費合計 = 小計C + 小計D;
            直接利益     = 限界利益 - 乗務員直接費合計;
            当月利益     = 直接利益 - AppCommon.IntParse((rowS01["一般管理費"] == null ? 0 : rowS01["一般管理費"]).ToString());

            decimal.TryParse(rowS01["運送収入"].ToString(), out dJyosu);
            if (dJyosu != 0)
            {
                当月利益率 = Math.Round(AppCommon.DecimalParse((当月利益 * 100).ToString()) / dJyosu, 1, MidpointRounding.AwayFromZero);
            }
            else
            {
                当月利益率 = 0;
            }

            空車KM = AppCommon.IntParse((rowS01["走行KM"] == null ? 0 : rowS01["走行KM"]).ToString()) - AppCommon.IntParse((rowS01["実車KM"] == null ? 0 : rowS01["実車KM"]).ToString());

            decimal.TryParse(rowS01["燃料L"].ToString(), out dJyosu);
            if (dJyosu != 0)
            {
                燃費 = Math.Round((AppCommon.DecimalParse((rowS01["走行KM"] == null ? 0 : rowS01["走行KM"]).ToString()) / dJyosu), 1, MidpointRounding.AwayFromZero);
            }
            else
            {
                燃費 = 0;
            }

            decimal.TryParse(rowS01["走行KM"].ToString(), out dJyosu);
            if (dJyosu != 0)
            {
                収入 = AppCommon.IntParse(Math.Round(AppCommon.DecimalParse((rowS01["運送収入"] == null ? 0 : rowS01["運送収入"]).ToString()) / dJyosu, 0, MidpointRounding.AwayFromZero).ToString());
            }
            else
            {
                収入 = 0;
            }

            decimal.TryParse(rowS01["走行KM"].ToString(), out dJyosu);
            if (dJyosu != 0)
            {
                輸送原価 = AppCommon.IntParse(Math.Round(AppCommon.DecimalParse((AppCommon.IntParse(rowS01["一般管理費"].ToString()) + 小計B + 小計C + 小計D).ToString()) / dJyosu, 0, MidpointRounding.AwayFromZero).ToString());
            }
            else
            {
                輸送原価 = 0;
            }

            Koteihi_Color();
        }