コード例 #1
0
        // View  Data
        private void viewAccountContToDgv(DataRow dr, DataGridViewRow dgvRow)
        {
            DateTime pdt = DHandling.StripTime(Convert.ToDateTime(dr["WorkDate"]));

            if (pdt == DateTime.MinValue)
            {
                dgvRow.Cells["Month"].Value = "";
                dgvRow.Cells["Day"].Value   = "";
            }
            else
            {
                dgvRow.Cells["Month"].Value = Convert.ToString(pdt.Month);
                dgvRow.Cells["Day"].Value   = Convert.ToString(pdt.Day);
            }

            dgvRow.Cells["ItemCode"].Value   = Convert.ToString(dr["ItemCode"]);
            dgvRow.Cells["Item"].Value       = Convert.ToString(dr["Item"]);
            dgvRow.Cells["ItemDetail"].Value = Convert.ToString(dr["ItemDetail"]);

            if (Convert.ToString(dr["Unit"]) != "")
            {
                decimal qty  = Convert.ToDecimal(dr["Quantity"]);
                decimal cost = Convert.ToDecimal(dr["CCost"]);
                //decimal hamt = Convert.ToDecimal(dr["HAmount"]);
                dgvRow.Cells["Quantity"].Value = decPointFormat(qty);
                dgvRow.Cells["Unit"].Value     = Convert.ToString(dr["Unit"]);
                dgvRow.Cells["CCost"].Value    = decFormat(cost);
                dgvRow.Cells["Amount"].Value   = decFormat(qty * cost);
                dgvRow.Cells["HAmount"].Value  = (Convert.ToDecimal(dr["HAmount"]) > 0) ? decFormat(Convert.ToDecimal(dr["HAmount"])) : "";
            }
        }
コード例 #2
0
        private void calculateLine(DataGridViewRow dgvRow)
        {
            // Wakamatsu 20170307
            //if (!(DHandling.IsDecimal(Convert.ToString(dgvRow.Cells["Quantity"].Value)))) return;
            //if (Convert.ToString(dgvRow.Cells["UnitPrice"].Value) == "") return;

            //decimal calcUnitPrice = toRegDecimal(Convert.ToString(dgvRow.Cells["UnitPrice"].Value));
            //decimal calcQuantity = toRegDecimal(Convert.ToString(dgvRow.Cells["Quantity"].Value));
            decimal calcQuantity  = 0;
            decimal calcUnitPrice = 0;

            if ((DHandling.IsDecimal(Convert.ToString(dgvRow.Cells["Quantity"].Value))))
            {
                calcQuantity = toRegDecimal(Convert.ToString(dgvRow.Cells["Quantity"].Value));
            }
            if ((DHandling.IsDecimal(Convert.ToString(dgvRow.Cells["UnitPrice"].Value))))
            {
                calcUnitPrice = toRegDecimal(Convert.ToString(dgvRow.Cells["UnitPrice"].Value));
            }
            // Wakamatsu 20170307
            decimal calcCost = calcUnitPrice * calcQuantity;

            dgvRow.Cells["Quantity"].Value  = decPointFormat(calcQuantity);
            dgvRow.Cells["UnitPrice"].Value = decFormat(calcUnitPrice);
            dgvRow.Cells["Cost"].Value      = decFormat(calcCost);
            calculateAmount();
        }
コード例 #3
0
        private void verticalCalc(DataGridView dgv)
        {
            Calculation calc = new Calculation(ted);

            calc.VCalcOutsource(dgv);
            labelSum.Text = DHandling.DecimaltoStr(calc.Sum, "#,0");
        }
コード例 #4
0
        private void createExcelFile(string templateFileName, string sheetName)
        {
            Publish     publ = new Publish(Folder.DefaultExcelTemplate(templateFileName));
            PublishData pd   = new PublishData();

            pd.TaskCode  = ted.TaskCode;
            pd.TaskName  = ted.TaskName;
            pd.CostType  = ted.CostType;
            pd.TaskPlace = ted.TaskPlace;
            pd.StartDate = ted.StartDate;
            pd.EndDate   = ted.EndDate;
            pd.TaxRate   = ted.TaxRate;

            pd.Publisher      = Convert.ToString(comboBoxOffice.SelectedValue) + Convert.ToString(comboBoxWork.SelectedValue);
            pd.OrderDate      = dateTimePickerOrderDate.Value;
            pd.OrderStartDate = dateTimePickerOStart.Value;
            pd.OrderEndDate   = dateTimePickerOEnd.Value;
            pd.InspectDate    = dateTimePickerInspectDate.Value;
            pd.ReceiptDate    = dateTimePickerReceiptDate.Value;
            pd.OrderPartner   = comboBoxPartner.Text;
            pd.Place          = textBoxDeliveryPoint.Text;
            pd.Note           = textBoxNote.Text;
            pd.PayRoule       = Convert.ToInt32(comboBoxPayRoule.SelectedValue);
            pd.OrderNo        = labelOrderNo.Text;
            pd.Amount         = DHandling.ToRegDecimal(labelSum.Text);
            pd.Tax            = pd.Amount * pd.TaxRate;

            pd.OfficeCode    = Convert.ToString(comboBoxOffice.SelectedValue);
            pd.OfficeName    = comboBoxOffice.Text;
            pd.PublishOffice = (checkBoxPublish.Checked) ? 1 : 0;


            publ.ExcelFile(sheetName, pd, dataGridView1);
            return;
        }
コード例 #5
0
        //private void viewLastMonthOsResultsContToDgv(int osResultsID, string item, DataGridViewRow dgvRow)
        //{
        //    // 過去データ
        //    string wParam = " WHERE OsResultsID = " + Convert.ToString(osResultsID)
        //        + " AND RecordedDate < '" + Convert.ToDateTime((dateTimePickerRecordedDate.Value).EndOfMonth())
        //        + "' AND Item = '" + item + "'";
        //    BillingOp blo = new BillingOp();
        //    DataTable dt = blo.UsingParamater_Select("D_OsResultsCont", wParam);
        //    if (dt == null) return;
        //    DataRow dr;
        //    decimal sum = 0;
        //    for (int i = 0; i < dt.Rows.Count; i++)
        //    {
        //        dr = dt.Rows[i];
        //        sum += Convert.ToDecimal(dr["Quantity"]);   // 各月の数量の和 = 前月累計
        //    }
        //    dr = dt.Rows[0];
        //    viewOsResultsContItemToDgv(dgvRow, dr);
        //    dgvRow.Cells["LQuantity"].Value = DHandling.DecimaltoStr(sum, "0.00");
        //    dgvRow.Cells["LAmount"].Value = DHandling.DecimaltoStr(sum * Convert.ToDecimal(dr["Cost"]), "0.00");
        //    dgvRow.Cells["ContID"].Value = 0;
        //}

        private void viewLastMonthOsResultsContToDgv(OsResultsData ord, string item, DataGridViewRow dgvRow)
        {
            // 過去データ
            string wParam = " WHERE TaskEntryID = " + ord.TaskEntryID + " AND PartnerCode = '" + ord.PartnerCode + "' "
                            + "AND RecordedDate < '" + ord.RecordedDate + "' AND Item = '" + item + "' AND Subject = '*'";
            BillingOp blo = new BillingOp();
            DataTable dt  = blo.UsingParamater_Select("D_OsResultsCont", wParam);

            if (dt == null)
            {
                return;
            }
            DataRow dr;
            decimal sum = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dr   = dt.Rows[i];
                sum += Convert.ToDecimal(dr["Quantity"]);     // 各月の数量の和 = 前月累計
            }
            dr = dt.Rows[0];
            viewOsResultsContItemToDgv(dgvRow, dr);
            dgvRow.Cells["LQuantity"].Value = DHandling.DecimaltoStr(sum, "0.00");
            dgvRow.Cells["LAmount"].Value   = DHandling.DecimaltoStr(sum * Convert.ToDecimal(dr["Cost"]), "#,0");
            dgvRow.Cells["ContID"].Value    = 0;
        }
コード例 #6
0
 private void viewOutsourceData(int idx)
 {
     comboBoxOffice.SelectedValue   = osd[idx].OfficeCode;
     comboBoxWork.SelectedValue     = osd[idx].Department;
     labelOrderNo.Text              = osd[idx].OrderNo;
     comboBoxPartner.SelectedValue  = osd[idx].PartnerCode;
     comboBoxPayRoule.SelectedValue = osd[idx].PayRoule;
     labelSum.Text = DHandling.DecimaltoStr(osd[idx].Amount, "#,0");
     if (DHandling.CheckDate(osd[idx].OrderDate))
     {
         dateTimePickerOrderDate.Value = osd[idx].OrderDate;
     }
     if (DHandling.CheckDate(osd[idx].StartDate))
     {
         dateTimePickerOStart.Value = osd[idx].StartDate;
     }
     if (DHandling.CheckDate(osd[idx].EndDate))
     {
         dateTimePickerOEnd.Value = osd[idx].EndDate;
     }
     if (DHandling.CheckDate(osd[idx].InspectDate))
     {
         dateTimePickerInspectDate.Value = osd[idx].InspectDate;
     }
     if (DHandling.CheckDate(osd[idx].ReceiptDate))
     {
         dateTimePickerReceiptDate.Value = osd[idx].ReceiptDate;
     }
     textBoxDeliveryPoint.Text = osd[idx].Place;
     textBoxNote.Text          = osd[idx].Note;
 }
コード例 #7
0
        private bool viewOutsourceContToDgv(DataTable dt, DataGridView dgv, string partnerCode)
        {
            PartnersData pd = new PartnersData();

            labelPartner.Text = pd.SelectPartnerName(partnerCode);

            DataRow dr;
            decimal sum = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dr   = dt.Rows[i];
                sum += Convert.ToDecimal(dr["Quantity"]);   // 各月の数量の和 = 前月累計
                dgv.Rows[i].Cells["ItemCode"].Value = Convert.ToString(dr["ItemCode"]);
                dgv.Rows[i].Cells["Item"].Value     = Convert.ToString(dr["Item"]);
                if (Convert.ToString(dr["Item"]) == null || Convert.ToString(dr["Item"]) == "")
                {
                    dgv.Rows[i].Cells["Item"].Value = Convert.ToString(dr["ItemDetail"]);
                }
                dgv.Rows[i].Cells["PQuantity"].Value = DHandling.DecimaltoStr(Convert.ToDecimal(dr["Quantity"]), "0.00");
                dgv.Rows[i].Cells["Unit"].Value      = Convert.ToString(dr["Unit"]);
                dgv.Rows[i].Cells["Cost"].Value      = DHandling.DecimaltoStr(Convert.ToDecimal(dr["Cost"]), "#,0");
                dgv.Rows[i].Cells["PAmount"].Value   = DHandling.DecimaltoStr(Convert.ToDecimal(dr["Quantity"]) * Convert.ToDecimal(dr["Cost"]), "#,0");
                dgv.Rows[i].Cells["ContID"].Value    = 0;
            }
            return(true);
        }
コード例 #8
0
ファイル: FormCostList.cs プロジェクト: kyas21/FTB
        private void FormCostList_Load(object sender, EventArgs e)
        {
            UiHandling ui = new UiHandling(dataGridView1);

            ui.DgvReadyNoRHeader();

            // 列幅設定、入力不可設定
            for (int i = 0; i < dataGridView1.ColumnCount; i++)
            {
                dataGridView1.Columns[i].ReadOnly = true;
            }
            //if (cmd.GetLength(0) > 1) dataGridView1.Rows.Add(cmd.GetLength(0) - 1);
            if (cmd.Length > 1)
            {
                dataGridView1.Rows.Add(cmd.Length - 1);
            }
            //for (int i = 0; i < cmd.GetLength(0); i++)
            for (int i = 0; i < cmd.Length; i++)
            {
                dataGridView1.Rows[i].Cells[0].Value = cmd[i].CostCode;
                dataGridView1.Rows[i].Cells[1].Value = cmd[i].Item.Replace("(支払い)", "");
                dataGridView1.Rows[i].Cells[2].Value = cmd[i].ItemDetail;
                dataGridView1.Rows[i].Cells[3].Value = cmd[i].Unit;
                dataGridView1.Rows[i].Cells[4].Value = (cmd[i].Cost == 0) ? "": DHandling.DecimaltoStr(cmd[i].Cost, "0.00");
                dataGridView1.Rows[i].Cells[5].Value = cmd[i].CostID;
            }
        }
コード例 #9
0
        private bool checkInputData(DataGridView dgv)
        {
            string checkStr;

            for (int i = 0; i < dgv.RowCount; i++)
            {
                if (dgv.Rows[i].Cells["Cost"].Value != null)
                {
                    for (int j = 3; j < dgv.ColumnCount; j++)
                    {
                        if (j != 4)
                        {
                            checkStr = Convert.ToString(dgv.Rows[i].Cells[j].Value);
                            if (checkStr == null || checkStr == "")
                            {
                            }
                            else
                            {
                                if (!DHandling.IsDecimal(checkStr))
                                {
                                    DMessage.ValueErrMsg();
                                    //dgv[j, i].Style.BackColor = Color.Red;
                                    dgv.CurrentCell = dgv[j, i];
                                    return(false);
                                }
                            }
                        }
                    }
                }
            }
            return(true);
        }
コード例 #10
0
ファイル: FormOsPayment.cs プロジェクト: kyas21/FTB
        private void dateTimePicker_ValueChanged(object sender, EventArgs e)
        {
            if (iniPro)
            {
                return;
            }
            DateTimePicker dtp = ( DateTimePicker )sender;

            buttonEnabled();

            if (DHandling.CheckPastTheDeadline(dtp.Value, clsArray, Conv.OfficeCode))
            {
                buttonDisEnabled();
            }

            if (preReportDate != dtp.Value.StripTime())
            {
                Func <DialogResult> dialogOverLoad = DMessage.DialogOverLoad;
                if (dialogOverLoad() == DialogResult.No)
                {
                    dtp.Value = preReportDate;
                    return;
                }
            }
            selectPaymentData(dataGridView1, dateTimePickerEx1.Value.EndOfMonth(), Conv.OfficeCode, Conv.DepartCode);
        }
コード例 #11
0
ファイル: FormVolumeInvoice.cs プロジェクト: kyas21/FTB
        private void editViewNextData(DataGridView dgv)
        {
            for (int i = 0; i < dgv.Rows.Count; i++)
            {
                if (string.IsNullOrEmpty(Convert.ToString(dgv.Rows[i].Cells["CAmount"].Value)))
                {
                    continue;
                }
                decimal sqty = (string.IsNullOrEmpty(Convert.ToString(dgv.Rows[i].Cells["SQuantity"].Value))) ? 0
                    : DHandling.ToRegDecimal(Convert.ToString(dgv.Rows[i].Cells["SQuantity"].Value));
                decimal samt = (string.IsNullOrEmpty(Convert.ToString(dgv.Rows[i].Cells["SAmount"].Value))) ? 0
                    : DHandling.ToRegDecimal(Convert.ToString(dgv.Rows[i].Cells["SAmount"].Value));
                decimal qty = (string.IsNullOrEmpty(Convert.ToString(dgv.Rows[i].Cells["Quantity"].Value))) ? 0
                    : DHandling.ToRegDecimal(Convert.ToString(dgv.Rows[i].Cells["Quantity"].Value));
                decimal amt = (string.IsNullOrEmpty(Convert.ToString(dgv.Rows[i].Cells["Amount"].Value))) ? 0
                    : DHandling.ToRegDecimal(Convert.ToString(dgv.Rows[i].Cells["Amount"].Value));
                dgv.Rows[i].Cells["SQuantity"].Value = decPointFormat(sqty + qty);
                dgv.Rows[i].Cells["SAmount"].Value   = decFormat(samt + amt);


                decimal cqty = DHandling.ToRegDecimal(Convert.ToString(dgv.Rows[i].Cells["CQuantity"].Value));
                decimal camt = DHandling.ToRegDecimal(Convert.ToString(dgv.Rows[i].Cells["SAmount"].Value));
                qty = cqty - (sqty + qty);
                amt = camt - (samt + amt);
                dgv.Rows[i].Cells["Quantity"].Value = decPointFormat(qty);
                dgv.Rows[i].Cells["Amount"].Value   = decFormat(amt);
            }
        }
コード例 #12
0
ファイル: PublishContractWorks.cs プロジェクト: kyas21/FTB
        private void editContractSummary(PublishData pd, DataGridView dgv)
        {
            //MessageBox.Show( "Excel書込み開始" );

            oWSheet.Cell(3, 1).Value = pd.vYear + "年度";
            oWSheet.Cell(3, 2).Value = "事業所:" + pd.OfficeName;

            oWSheet.Row(7).Height = 24;

            readyExcelRows(dgv, 1, 16, 7);
            const int SR = 8;       // Excel Sheet Start Row No.

            for (int i = 0; i < dgv.Rows.Count; i++)
            {
                oWSheet.Cell(SR + i, 1).Value = Convert.ToString(dgv.Rows[i].Cells["TaskCode"].Value);
                oWSheet.Cell(SR + i, 2).Value = Convert.ToString(dgv.Rows[i].Cells["PartnerName"].Value);
                oWSheet.Cell(SR + i, 3).Value = Convert.ToString(dgv.Rows[i].Cells["TaskName"].Value);

                if (!string.IsNullOrEmpty(Convert.ToString(dgv.Rows[i].Cells["TaskName"].Value)))
                {
                    int k = 4;
                    for (int j = 0; j < 12; j++)
                    {
                        oWSheet.Cell(SR + i, k).Value =
                            DHandling.ToRegDecimal(Convert.ToString(dgv.Rows[i].Cells["Cost" + j.ToString("00")].Value));
                        k++;
                    }
                    oWSheet.Cell(SR + i, k).Value =
                        DHandling.ToRegDecimal(Convert.ToString(dgv.Rows[i].Cells["CostSum"].Value));
                }
                oWSheet.Row(SR + i).Height = 24;
            }
        }
コード例 #13
0
        private void verticalCalc()
        {
            ted.TaxRate  = DHandling.ToRegDecimal(textBoxTaxRate.Text) / 100;
            ted.Expenses = DHandling.ToRegDecimal(textBoxExpenses.Text) / 100;

            Calculation calc = new Calculation(ted);

            calc.VCalcEstimate(dataGridView1);
        }
コード例 #14
0
 private void viewOsResultsContItemToDgv(DataGridViewRow dgvRow, DataRow dr)
 {
     dgvRow.Cells["ItemCode"].Value  = Convert.ToString(dr["ItemCode"]);
     dgvRow.Cells["Item"].Value      = Convert.ToString(dr["Item"]);
     dgvRow.Cells["PQuantity"].Value = DHandling.DecimaltoStr(Convert.ToDecimal(dr["PQuantity"]), "0.00");
     dgvRow.Cells["Unit"].Value      = Convert.ToString(dr["Unit"]);
     dgvRow.Cells["Cost"].Value      = DHandling.DecimaltoStr(Convert.ToDecimal(dr["Cost"]), "#,0");
     dgvRow.Cells["PAmount"].Value   = DHandling.DecimaltoStr(Convert.ToDecimal(dr["PQuantity"]) * Convert.ToDecimal(dr["Cost"]), "#,0");
 }
コード例 #15
0
ファイル: FormRegular.cs プロジェクト: kyas21/FTB
        // DataGridViewの全体計算(横計算&縦計算)
        private bool reCalculateAll(DataGridView dgvL, DataGridView dgvR, DataGridView dgvT)
        {
            if (!checkInputContData(dgvL))
            {
                return(false);
            }

            decimal[] qty = new decimal[subjCnt];

            for (int i = 0; i < dgvL.RowCount; i++)
            {
                for (int j = 0; j < subjCnt; j++)
                {
                    if (dgvL.Rows[i].Cells["QuantityL" + j.ToString()].Value != null)
                    {
                        qty[j] += DHandling.ToRegDecimal(Convert.ToString(dgvL.Rows[i].Cells["QuantityL" + j.ToString()].Value));
                    }
                }
            }

            for (int i = 0; i < dgvR.RowCount; i++)
            {
                for (int j = 0; j < subjCnt; j++)
                {
                    if (dgvR.Rows[i].Cells["QuantityR" + j.ToString()].Value != null)
                    {
                        qty[j] += DHandling.ToRegDecimal(Convert.ToString(dgvR.Rows[i].Cells["QuantityR" + j.ToString()].Value));
                    }
                }
            }

            this.labelSum = new Label[] { this.labelSumQty0, this.labelSumQty1, this.labelSumQty2, this.labelSumQty3, this.labelSumQty4, this.labelSumQty5 };
            for (int j = 0; j < subjCnt; j++)
            {
                labelSum[j].Text = DHandling.DecimaltoStr(qty[j], "0.00");
                dgvT.Rows[j].Cells["Quantity"].Value = DHandling.DecimaltoStr(qty[j], "0.00");
            }

            if (!checkInputSumData(dgvT))
            {
                return(false);
            }

            decimal cost;

            for (int i = 0; i < subjCnt; i++)
            {
                if (dgvT.Rows[i].Cells["Cost"].Value != null)
                {
                    cost = DHandling.ToRegDecimal(Convert.ToString(dgvT.Rows[i].Cells["Cost"].Value));
                    dgvT.Rows[i].Cells["Amount"].Value = DHandling.DecimaltoStr(cost * qty[i], "0.00");
                }
            }
            return(true);
        }
コード例 #16
0
ファイル: FormOsPayment.cs プロジェクト: kyas21/FTB
        private void calculateInvolvedItems(DataGridViewRow dgvRow)
        {
            decimal oAmount = DHandling.ToRegDecimal(Convert.ToString(dgvRow.Cells["OAmount"].Value));
            decimal sAmount = DHandling.ToRegDecimal(Convert.ToString(dgvRow.Cells["SAmount"].Value));
            decimal amount  = DHandling.ToRegDecimal(Convert.ToString(dgvRow.Cells["Amount"].Value));

            dgvRow.Cells["ROAmount"].Value = decFormat(oAmount - sAmount - amount);
            dgvRow.Cells["OAmount"].Value  = decFormat(oAmount);
            dgvRow.Cells["SAmount"].Value  = decFormat(sAmount);
            dgvRow.Cells["Amount"].Value   = decFormat(amount);
        }
コード例 #17
0
 //----------------------------------------------------------------------------//
 //     SubRoutine                                                             //
 //----------------------------------------------------------------------------//
 // Label編集
 // 工期
 private void create_lblTerm()
 {
     if (DHandling.CheckDate(ted.StartDate))
     {
         labelTerm.Text = DHandling.PickUpTopCharacters(Convert.ToString(ted.StartDate), 10) + "  ~  ";
         if (DHandling.CheckDate(ted.EndDate))
         {
             labelTerm.Text += DHandling.PickUpTopCharacters(Convert.ToString(ted.EndDate), 10);
         }
     }
 }
コード例 #18
0
ファイル: FormRegular.cs プロジェクト: kyas21/FTB
 private bool checkDecimalValue(string checkStr)
 {
     if (!String.IsNullOrEmpty(checkStr))
     {
         if (!DHandling.IsDecimal(checkStr))
         {
             DMessage.ValueErrMsg();
             return(false);
         }
     }
     return(true);
 }
コード例 #19
0
ファイル: FormVolumeInvoice.cs プロジェクト: kyas21/FTB
        // View  Data
        private void viewAccountContToDgv(DataRow dr, DataGridViewRow dgvRow)
        {
            DateTime pdt = DHandling.StripTime(Convert.ToDateTime(dr["WorkDate"]));

            if (pdt == DateTime.MinValue)
            {
                dgvRow.Cells["Month"].Value = "";
                dgvRow.Cells["Day"].Value   = "";
            }
            else
            {
                dgvRow.Cells["Month"].Value = Convert.ToString(pdt.Month);
                dgvRow.Cells["Day"].Value   = Convert.ToString(pdt.Day);
            }

            dgvRow.Cells["ItemCode"].Value   = Convert.ToString(dr["ItemCode"]);
            dgvRow.Cells["Item"].Value       = Convert.ToString(dr["Item"]);
            dgvRow.Cells["ItemDetail"].Value = Convert.ToString(dr["ItemDetail"]);

            if (Convert.ToString(dr["Unit"]) != "")
            {
                //契約項目
                decimal qty  = Convert.ToDecimal(dr["CQuantity"]);
                decimal cost = Convert.ToDecimal(dr["CCost"]);
                dgvRow.Cells["CQuantity"].Value = decPointFormat(qty);
                dgvRow.Cells["Unit"].Value      = Convert.ToString(dr["Unit"]);
                dgvRow.Cells["CCost"].Value     = decFormat(cost);
                dgvRow.Cells["CAmount"].Value   = decFormat(qty * cost);

                //前月までの請求
                dgvRow.Cells["SQuantity"].Value = (string.IsNullOrEmpty(Convert.ToString(dr["SQuantity"]))) ? "0" : decPointFormat(Convert.ToDecimal(dr["SQuantity"]));
                dgvRow.Cells["SAmount"].Value   = (string.IsNullOrEmpty(Convert.ToString(dr["SAmount"]))) ? "0" : decFormat(Convert.ToDecimal(dr["SAmount"]));

                //当月数量、金額
                dgvRow.Cells["Quantity"].Value = decPointFormat(Convert.ToDecimal(dr["Quantity"]));

                if (cost != 0 && Convert.ToDecimal(dr["Amount"]) == 0)
                {
                    dgvRow.Cells["Amount"].Value = decFormat(cost * Convert.ToDecimal(dr["Quantity"]));
                }
                else
                {
                    dgvRow.Cells["Amount"].Value = decFormat(Convert.ToDecimal(dr["Amount"]));
                }

                //マニュアル入力金額
                dgvRow.Cells["HAmount"].Value = (Convert.ToDecimal(dr["HAmount"]) > 0) ? decFormat(Convert.ToDecimal(dr["HAmount"])) : "";

                //マニュアル契約金額
                dgvRow.Cells["HContract"].Value = (Convert.ToDecimal(dr["HContract"]) > 0) ? decFormat(Convert.ToDecimal(dr["HContract"])) : "";
            }
        }
コード例 #20
0
ファイル: FormRegular.cs プロジェクト: kyas21/FTB
        // View  Data
        private void viewOsResultsContToDgv(DataRow dr, DataGridViewRow dgvRow, string pos)
        {
            DateTime pdt = (Convert.ToDateTime(dr["PublishDate"])).StripTime();

            dgvRow.Cells["ItemCode" + pos].Value = Convert.ToString(dr["ItemCode"]);
            dgvRow.Cells["Item" + pos].Value     = Convert.ToString(dr["Item"]);
            int subNo = Convert.ToInt32(dr["Subject"]);

            dgvRow.Cells["Quantity" + pos + subNo.ToString()].Value = (Convert.ToDecimal(dr["Quantity"]) == 0) ? ""
                : DHandling.DecimaltoStr(Convert.ToDecimal(dr["Quantity"]), "0.00");

            dgvRow.Cells["PublishDate" + pos].Value = Convert.ToString(Convert.ToDateTime(dr["PublishDate"]));
        }
コード例 #21
0
        private bool viewOutsourceContToDgv(DataTable dt, DataGridView dgv)
        {
            if (dt == null)
            {
                return(false);
            }
            DataRow dr;
            decimal qty  = 0;
            decimal cost = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dr = dt.Rows[i];
                dgv.Rows[i].Cells["ItemCode"].Value   = Convert.ToString(dr["ItemCode"]);
                dgv.Rows[i].Cells["Item"].Value       = Convert.ToString(dr["Item"]);
                dgv.Rows[i].Cells["ItemDetail"].Value = Convert.ToString(dr["ItemDetail"]);

                if (plnd == null || plnd.PlanningID == 0)
                {
                    if (Convert.ToDecimal(dr["Cost"]) == 0)
                    {
                        qty = 0;
                    }
                    cost = Convert.ToDecimal(dr["Cost"]);
                }
                else
                {
                    if (Convert.ToDecimal(dr["Cost1"]) == 0)
                    {
                        qty = 0;
                    }
                    cost = Convert.ToDecimal(dr["Cost1"]);
                }
                if (cost != 0)
                {
                    qty = Convert.ToDecimal(dr["Quantity"]);
                }

                if (Convert.ToString(dr["Unit"]) != "")
                {
                    dgv.Rows[i].Cells["Quantity"].Value = qty;
                    dgv.Rows[i].Cells["Unit"].Value     = Convert.ToString(dr["Unit"]);
                    dgv.Rows[i].Cells["Cost"].Value     = DHandling.DecimaltoStr(cost, "#,0");
                    dgv.Rows[i].Cells["Amount"].Value   = DHandling.DecimaltoStr(qty * cost, "#,0");
                }
            }
            return(true);
        }
コード例 #22
0
ファイル: FormOsPayment.cs プロジェクト: kyas21/FTB
 private OsPaymentData moveIndividualData(DataGridViewRow dgvRow)
 {
     opd.ItemCode     = Convert.ToString(dgvRow.Cells["ItemCode"].Value);
     opd.Item         = Convert.ToString(dgvRow.Cells["Item"].Value);
     opd.OrderNo      = Convert.ToString(dgvRow.Cells["OrderNo"].Value);
     opd.TaskCode     = Convert.ToString(dgvRow.Cells["TaskCode"].Value);
     opd.OrderAmount  = DHandling.ToRegDecimal(Convert.ToString(dgvRow.Cells["OAmount"].Value));
     opd.SAmount      = DHandling.ToRegDecimal(Convert.ToString(dgvRow.Cells["SAmount"].Value));
     opd.Amount       = DHandling.ToRegDecimal(Convert.ToString(dgvRow.Cells["Amount"].Value));
     opd.LeaderMCode  = Convert.ToString(dgvRow.Cells["LeaderMCode"].Value);
     opd.SlipNo       = (Convert.ToString(dgvRow.Cells["SlipNo"].Value) == "") ? 0 : Convert.ToInt32(dgvRow.Cells["SlipNo"].Value);
     opd.CostReportID = (Convert.ToString(dgvRow.Cells["CostReportID"].Value) == "") ? 0 : Convert.ToInt32(dgvRow.Cells["CostReportID"].Value);
     opd.TaskName     = Convert.ToString(dgvRow.Cells["TaskName"].Value);
     opd.Unit         = "式";
     return(opd);
 }
コード例 #23
0
ファイル: Publish.cs プロジェクト: kyas21/FTB
        private void editPlanningCont(PublishData pd, DataGridView dgv)
        {
            //MessageBox.Show("Excel書込み開始");

            string[] titleArray = new string[] { " 原 予 算 ", " 変 更 1 回 ", " 変 更 2 回 " };

            //var HeaderText = @"&U&24" + titleArray[pd.Version] + "内 訳 書";
            var HeaderText = @"&U&24" + titleArray[pd.PublishIndex] + "内 訳 書 ";

            oWSheet.PageSetup.Header.Center.AddText(HeaderText);

            readyExcelRows(dgv, 2, 12, 4);
            const int SR = 4;       // Excel Sheet Start Row No.

            for (int i = 0; i < dgv.Rows.Count; i++)
            {
                oWSheet.Cell(SR + i, 1).Value = Convert.ToString(dgv.Rows[i].Cells["Item"].Value);
                oWSheet.Cell(SR + i, 2).Value = Convert.ToString(dgv.Rows[i].Cells["ItemDetail"].Value);
                if (Convert.ToString(dgv.Rows[i].Cells["Quantity"].Value) != "")
                {
                    oWSheet.Cell(SR + i, 3).Value = Convert.ToDecimal(dgv.Rows[i].Cells["Quantity"].Value);
                }
                oWSheet.Cell(SR + i, 4).Value = Convert.ToString(dgv.Rows[i].Cells["Unit"].Value);

                for (int j = 0; j < 3; j++)
                {
                    if (Convert.ToString(dgv.Rows[i].Cells["Amount" + j.ToString()].Value) == "")
                    {
                        //oWSheet.Cell(SR + i, j * 2 + 5).Value = null;     // 単価
                        //oWSheet.Cell(SR + i, j * 2 + 6).Value = null;     // 金額
                    }
                    else
                    {
                        if (Convert.ToString(dgv.Rows[i].Cells["Cost" + j.ToString()].Value) == "")
                        {
                            oWSheet.Cell(SR + i, j * 2 + 6).Value =
                                DHandling.ToRegDecimal(Convert.ToString(dgv.Rows[i].Cells["Amount" + j.ToString()].Value));
                        }
                        else
                        {
                            oWSheet.Cell(SR + i, j * 2 + 5).Value =
                                DHandling.ToRegDecimal(Convert.ToString(dgv.Rows[i].Cells["Cost" + j.ToString()].Value));
                        }
                    }
                }
            }
        }
コード例 #24
0
ファイル: FormMenuEstPlan.cs プロジェクト: kyas21/FTB
        private void displayDetailLabel(TaskEntryData ted)
        {
            SqlHandling sh = new SqlHandling("M_Members");

            string[] mCodeArray = new string[2];
            string[] mNameArray = new string[2];
            mCodeArray[0] = ted.LeaderMCode;
            mCodeArray[1] = ted.SalesMCode;
            MembersData md = new MembersData();

            for (int i = 0; i < mCodeArray.Length; i++)
            {
                if (!String.IsNullOrEmpty(mCodeArray[i]))
                {
                    mNameArray[i] = md.SelectMemberName(mCodeArray[i]);
                }
            }

            clearDetailLabel();
            // 業務担当者
            if (!String.IsNullOrEmpty(mNameArray[0]))
            {
                labelTtlLeader.Visible = true;
                labelLeaderName.Text   = mNameArray[0];
            }
            // 営業担当者
            if (!String.IsNullOrEmpty(mNameArray[1]))
            {
                labelTtlSales.Visible = true;
                labelSalesMName.Text  = mNameArray[1];
            }
            // 契約日
            if (DHandling.CheckDateMiniValue(ted.ContractDate))
            {
                labelContractDate.Text = "契約日: " + DHandling.PickUpTopCharacters(Convert.ToString(ted.ContractDate), 10);
            }
            // 工期 開始日
            if (DHandling.CheckDateMiniValue(ted.StartDate))
            {
                labelStartDate.Text = "工期: " + DHandling.PickUpTopCharacters(Convert.ToString(ted.StartDate), 10);
            }
            // 工期 終了日
            if (DHandling.CheckDateMiniValue(ted.EndDate))
            {
                labelStartDate.Text += "  ~  " + DHandling.PickUpTopCharacters(Convert.ToString(ted.EndDate), 10);
            }
        }
コード例 #25
0
 private void storeLatestOutsourceData(int idx)
 {
     //osd[idx].OrderNo = labelOrderNo.Text;
     osd[idx].PartnerCode = Convert.ToString(comboBoxPartner.SelectedValue);
     osd[idx].PayRoule    = Convert.ToInt32(comboBoxPayRoule.SelectedValue);
     osd[idx].Amount      = DHandling.ToRegDecimal(labelSum.Text);
     osd[idx].OrderDate   = dateTimePickerOrderDate.Value;
     osd[idx].StartDate   = dateTimePickerOStart.Value;
     osd[idx].EndDate     = dateTimePickerOEnd.Value;
     osd[idx].InspectDate = dateTimePickerInspectDate.Value;
     osd[idx].ReceiptDate = dateTimePickerReceiptDate.Value;
     osd[idx].OfficeCode  = Convert.ToString(comboBoxOffice.SelectedValue);
     osd[idx].Department  = Convert.ToString(comboBoxWork.SelectedValue);
     osd[idx].Publisher   = osd[idx].OfficeCode + osd[idx].Department;
     osd[idx].Place       = textBoxDeliveryPoint.Text;
     osd[idx].Note        = textBoxNote.Text;
 }
コード例 #26
0
ファイル: Publish.cs プロジェクト: kyas21/FTB
        private void editEstimateCont(DataGridView dgv)
        {
            //MessageBox.Show("Excel書込み開始");

            readyExcelRows(dgv, 2, 8, 1);
            const int SR = 2;       // Excel Sheet Start Row No.
            // Wakamatsu 20170329
            Calculation calc = new Calculation();

            for (int i = 0; i < dgv.Rows.Count; i++)
            {
                if (Convert.ToString(dgv.Rows[i].Cells["Amount"].Value) == "")
                {
                    oWSheet.Cell(SR + i, 6).Value = null;     // 金額欄
                }

                // Wakamatsu 20170324
                if (dgv.Rows[i].Cells["Item"].Value != null && dgv.Rows[i].Cells["ItemDetail"].Value != null)
                //else
                {
                    oWSheet.Cell(SR + i, 1).Value = Convert.ToString(dgv.Rows[i].Cells["Item"].Value);
                    oWSheet.Cell(SR + i, 2).Value = Convert.ToString(dgv.Rows[i].Cells["ItemDetail"].Value);
                    oWSheet.Cell(SR + i, 3).Value = DHandling.ToRegDecimal(Convert.ToString(dgv.Rows[i].Cells["Quantity"].Value));
                    oWSheet.Cell(SR + i, 4).Value = Convert.ToString(dgv.Rows[i].Cells["Unit"].Value);
                    oWSheet.Cell(SR + i, 5).Value = DHandling.ToRegDecimal(Convert.ToString(dgv.Rows[i].Cells["Cost"].Value));
                    if (Convert.ToString(dgv.Rows[i].Cells["Unit"].Value) == "")
                    {
                        // Wakamatsu 20170327
                        //oWSheet.Cell(SR + i, 6).Value = DHandling.ToRegDecimal(Convert.ToString(dgv.Rows[i].Cells["Amount"].Value));
                        oWSheet.Cell(SR + i, 3).Value = null;     // 数量欄
                        oWSheet.Cell(SR + i, 5).Value = null;     // 単価欄
                    }
                    // Wakamatsu 20170329
                    else if (calc.ExtractCalcWord(Convert.ToString(dgv.Rows[i].Cells["Item"].Value)) == Sign.Expenses)
                    {
                        oWSheet.Cell(SR + i, 3).Value = null;     // 数量欄
                        oWSheet.Cell(SR + i, 5).Value = null;     // 単価欄
                    }
                    // Wakamatsu 20170329
                    // Wakamatsu 20170327
                    oWSheet.Cell(SR + i, 6).Value = Convert.ToString(dgv.Rows[i].Cells["Amount"].Value);
                    oWSheet.Cell(SR + i, 7).Value = Convert.ToString(dgv.Rows[i].Cells["Note"].Value);
                }
            }
        }
コード例 #27
0
        // DataGridViewの全体計算(横計算&縦計算)
        private void reCalculateAll()
        {
            // HorizontalCalculation
            decimal cost = 0;
            decimal qty  = 0;
            decimal hAmt = 0;

            acntAmount = 0;
            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                if (string.IsNullOrEmpty(Convert.ToString(dataGridView1.Rows[i].Cells["HAmount"].Value)))
                {
                    cost = string.IsNullOrEmpty(Convert.ToString(dataGridView1.Rows[i].Cells["CCost"].Value)) ? 0
                                    : DHandling.ToRegDecimal(Convert.ToString(dataGridView1.Rows[i].Cells["CCost"].Value));
                    qty = string.IsNullOrEmpty(Convert.ToString(dataGridView1.Rows[i].Cells["Quantity"].Value)) ? 0
                                    : DHandling.ToRegDecimal(Convert.ToString(dataGridView1.Rows[i].Cells["Quantity"].Value));

                    dataGridView1.Rows[i].Cells["Amount"].Value = decFormat(qty * cost);

                    acntAmount += qty * cost;
                }
                else
                {
                    hAmt = string.IsNullOrEmpty(Convert.ToString(dataGridView1.Rows[i].Cells["HAmount"].Value)) ? 0
                                    : Convert.ToDecimal(dataGridView1.Rows[i].Cells["HAmount"].Value);
                    if (hAmt == 0)
                    {
                        dataGridView1.Rows[i].Cells["HAmount"].Value = null;
                    }
                    else
                    {
                        dataGridView1.Rows[i].Cells["HAmount"].Value = decFormat(hAmt);
                        dataGridView1.Rows[i].Cells["CCost"].Value   = null;
                        dataGridView1.Rows[i].Cells["Amount"].Value  = dataGridView1.Rows[i].Cells["HAmount"].Value;
                    }
                }

                if (DHandling.ToRegDecimal(Convert.ToString(dataGridView1.Rows[i].Cells["Amount"].Value)) == 0)
                {
                    dataGridView1.Rows[i].Cells["Amount"].Value = null;
                }
            }

            verticalCalc();
        }
コード例 #28
0
ファイル: FormRegular.cs プロジェクト: kyas21/FTB
        private void edit_Labels()
        {
            labelTaskCode.Text = ted.TaskCode;
            labelTask.Text     = ted.TaskName;
            PartnersData pd = new PartnersData();

            labelPartner.Text = pd.SelectPartnerName(ted.PartnerCode);
            MembersData md = new MembersData();

            labelSalesM.Text = md.SelectMemberName(ted.SalesMCode);
            labelLeader.Text = md.SelectMemberName(ted.LeaderMCode);

            recordedDate = DHandling.EndOfMonth(dateTimePickerRecDate.Value);

            labelOrderNo.Text = "";

            labelSubCo.Text   = "";
            textBoxSubCo.Text = "";
        }
コード例 #29
0
        private bool viewEstimateContToDgv(DataTable dt, DataGridView dgv)
        {
            string  wkCode;
            string  arrayNo;
            DataRow dr;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dr     = dt.Rows[i];
                wkCode = Convert.ToString(dr["ItemCode"]);
                dgv.Rows[i].Cells["Code"].Value       = wkCode;
                dgv.Rows[i].Cells["Item"].Value       = Convert.ToString(dr["Item"]);
                dgv.Rows[i].Cells["ItemDetail"].Value = Convert.ToString(dr["ItemDetail"]);
                if (Convert.ToString(dr["Unit"]) != "")
                {
                    dgv.Rows[i].Cells["Quantity"].Value = decPointFormat(Convert.ToDecimal(dr["Quantity"]));
                    dgv.Rows[i].Cells["Unit"].Value     = string.IsNullOrEmpty(Convert.ToString(dr["Unit"]))? null : Convert.ToString(dr["Unit"]);

                    arrayNo = "0";
                    if (!string.IsNullOrEmpty(wkCode))
                    {
                        if (DHandling.IsNumeric(wkCode))
                        {
                            if (Convert.ToInt32(wkCode) > 799)
                            {
                                arrayNo = "2";
                            }
                        }
                        else
                        {
                            if (wkCode[0] == 'G')
                            {
                                arrayNo = "2";
                            }
                        }
                    }

                    dgv.Rows[i].Cells["Cost" + arrayNo].Value = decFormat(Convert.ToDecimal(dr["Cost"]));
                }
            }
            return(true);
        }
コード例 #30
0
        //private void viewThisMonthOsResultsContToDgv(int osResultsID, string item, DataGridViewRow dgvRow)
        //{
        //    // 当月データ
        //    string wParam = " WHERE OsResultsID = " + Convert.ToString(osResultsID)
        //        + " AND RecordedDate = '" + Convert.ToDateTime((dateTimePickerRecordedDate.Value).EndOfMonth())
        //        + "' AND Item = '" + item + "'";
        //    BillingOp blo = new BillingOp();
        //    DataTable dt = blo.UsingParamater_Select("D_OsResultsCont", wParam);
        //    if (dt == null)
        //    {
        //        dgvRow.Cells["Quantity"].Value = "0.00";
        //        dgvRow.Cells["ContID"].Value = 0;
        //    }
        //    else
        //    {
        //        DataRow dr = dt.Rows[0];
        //        viewOsResultsContItemToDgv(dgvRow, dr);
        //        dgvRow.Cells["Quantity"].Value = DHandling.DecimaltoStr(Convert.ToDecimal(dr["Quantity"]), "0.00");
        //        dgvRow.Cells["ContID"].Value = Convert.ToInt32(dr["OsResultsContID"]);
        //    }
        //}


        private void viewThisMonthOsResultsContToDgv(OsResultsData ord, string item, DataGridViewRow dgvRow)
        {
            // 当月データ
            string wParam = " WHERE TaskEntryID = " + ord.TaskEntryID + " AND PartnerCode = '" + ord.PartnerCode + "' "
                            + "AND RecordedDate = '" + ord.RecordedDate + "' AND Item = '" + item + "' AND Subject = '*'";
            BillingOp blo = new BillingOp();
            DataTable dt  = blo.UsingParamater_Select("D_OsResultsCont", wParam);

            if (dt == null)
            {
                dgvRow.Cells["Quantity"].Value = "0.00";
                dgvRow.Cells["ContID"].Value   = 0;
            }
            else
            {
                DataRow dr = dt.Rows[0];
                viewOsResultsContItemToDgv(dgvRow, dr);
                dgvRow.Cells["Quantity"].Value = DHandling.DecimaltoStr(Convert.ToDecimal(dr["Quantity"]), "0.00");
                dgvRow.Cells["ContID"].Value   = Convert.ToInt32(dr["OsResultsContID"]);
            }
        }