リビジョン 224
請求書日付データ作成追加
請求書データ作成日を請求日に変更
| branches/ddl/CreateBilling/CreateBilling/CreateBillingDataAux.cs | ||
|---|---|---|
| 242 | 242 | 
    IODepositDataDetail DepositDDB = new IODepositDataDetail();  | 
| 243 | 243 | 
    IOMApproval ApprovalMastDB = new IOMApproval();  | 
| 244 | 244 | 
    IOProcessApproval AppDB = new IOProcessApproval();  | 
| 245 | 
    IORequestOrderDate ReqDateDB = new IORequestOrderDate();  | 
|
| 245 | 246 | 
    strMsg = "請求データ作成";  | 
| 246 | 247 | 
    try  | 
| 247 | 248 | 
                {
   | 
| ... | ... | |
| 257 | 258 | 
    DepositDDB.connect(); DepositDDB.beginTran();  | 
| 258 | 259 | 
    ApprovalMastDB.connect(); ApprovalMastDB.beginTran();  | 
| 259 | 260 | 
    AppDB.connect(); AppDB.beginTran();  | 
| 261 | 
    ReqDateDB.connect(); ReqDateDB.beginTran();  | 
|
| 260 | 262 | 
     | 
| 261 | 263 | 
    string strOrderSQL = string.Empty;  | 
| 262 | 264 | 
    int nTargetmonth = 0;  | 
| ... | ... | |
| 305 | 307 | 
    if (!(bcommit = CreateDepositDataDetail(DepositDDB, objRec, InRec, nRequestNo, nOrderNo, nInvoiceNo, nTargetmonth, ref strMsg))) break;  | 
| 306 | 308 | 
    // 承認データ作成  | 
| 307 | 309 | 
    if (!(bcommit = CreateApprovalData(ApprovalMastDB, AppDB, objRec, InRec, nInvoiceNo, nOrderNo, nTargetmonth, ref strMsg))) break;  | 
| 310 | 
    // 請求書日付データ作成  | 
|
| 311 | 
    if (!(bcommit = CreateRequestOrderDate(ReqDateDB, objRec, InRec, nInvoiceNo, nOrderNo, nTargetmonth, ref strMsg))) break;  | 
|
| 308 | 312 | 
    }  | 
| 309 | 313 | 
     | 
| 310 | 314 | 
    if (!bcommit)  | 
| ... | ... | |
| 316 | 320 | 
    DepositDB.rollback();  | 
| 317 | 321 | 
    DepositDDB.rollback();  | 
| 318 | 322 | 
    AppDB.rollback();  | 
| 323 | 
    ReqDateDB.rollback();  | 
|
| 319 | 324 | 
    }  | 
| 320 | 325 | 
     | 
| 321 | 326 | 
    return true;  | 
| ... | ... | |
| 329 | 334 | 
    DepositDB.rollback();  | 
| 330 | 335 | 
    DepositDDB.rollback();  | 
| 331 | 336 | 
    AppDB.rollback();  | 
| 337 | 
    ReqDateDB.rollback();  | 
|
| 332 | 338 | 
     | 
| 333 | 339 | 
                    logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
   | 
| 334 | 340 | 
                    strMsg += string.Format(" システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
   | 
| ... | ... | |
| 346 | 352 | 
    DepositDB.commit();  | 
| 347 | 353 | 
    DepositDDB.commit();  | 
| 348 | 354 | 
    AppDB.commit();  | 
| 355 | 
    ReqDateDB.commit();  | 
|
| 349 | 356 | 
     | 
| 350 | 357 | 
    HeadDB.close(); HeadDB = null;  | 
| 351 | 358 | 
    DataDB.close(); DataDB = null;  | 
| ... | ... | |
| 354 | 361 | 
    DepositDB.close(); DepositDB = null;  | 
| 355 | 362 | 
    DepositDDB.close(); DepositDDB = null;  | 
| 356 | 363 | 
    AppDB.close(); AppDB = null;  | 
| 364 | 
    ReqDateDB.close(); ReqDateDB = null;  | 
|
| 357 | 365 | 
    }  | 
| 358 | 366 | 
    }  | 
| 359 | 367 | 
    #endregion  | 
| ... | ... | |
| 522 | 530 | 
    DetailRec.OrderersCode = nOrderersCode; // 発注者コード  | 
| 523 | 531 | 
    DetailRec.RequestMonth = nTargetmonth; // 請求月  | 
| 524 | 532 | 
    DetailRec.SeqNo = CommonMotions.cnvInt(objVal[0]) + 1; // 連番  | 
| 525 | 
    DetailRec.CretateDate = DateTime.Now; // 作成日  | 
|
| 526 | 533 | 
                    string strDate = string.Format("{0}/{1}/{2}", InRec.TargetMonth.Year, InRec.TargetMonth.Month, BillingDate.Day);
   | 
| 534 | 
    DateTime dtWork = DateTime.Now;  | 
|
| 527 | 535 | 
    if (CommonMotions.chkDate(strDate))  | 
| 528 | 536 | 
                    {   // 正常時はそのままに日付にする
   | 
| 529 | 
                        DetailRec.RequestDate = DateTime.Parse(strDate);        // 請求日
   | 
|
| 537 | 
                        dtWork = DateTime.Parse(strDate);
   | 
|
| 530 | 538 | 
    }  | 
| 531 | 539 | 
    else  | 
| 532 | 540 | 
                    {   // エラー時は月末日をセットする
   | 
| 533 | 541 | 
     | 
| 534 | 
                        DetailRec.RequestDate = new DateTime(InRec.TargetMonth.Year,
   | 
|
| 542 | 
                        dtWork = new DateTime(InRec.TargetMonth.Year,
   | 
|
| 535 | 543 | 
    InRec.TargetMonth.Month,  | 
| 536 | 544 | 
    DateTime.DaysInMonth(InRec.TargetMonth.Year, InRec.TargetMonth.Month));  | 
| 537 | 545 | 
    }  | 
| 546 | 
    DetailRec.CretateDate = dtWork; // 作成日  | 
|
| 547 | 
    DetailRec.RequestDate = dtWork; // 請求日  | 
|
| 538 | 548 | 
     | 
| 539 | 549 | 
    DetailRec.RequestName = CommonMotions.cnvString(objRec[m_DefColumn + (int)InDataOrder.ODetailString]); // 発注者先名  | 
| 540 | 550 | 
    DetailRec.TotalAmount = (long)InRec.PaymentAmount + (long)(InRec.PaymentAmount * 0.08); // 税込み合計金額  | 
| ... | ... | |
| 773 | 783 | 
    }  | 
| 774 | 784 | 
    }  | 
| 775 | 785 | 
    #endregion  | 
| 786 | 
     | 
|
| 787 | 
    #region 請求書日付データ作成  | 
|
| 788 | 
    /// <summary>  | 
|
| 789 | 
    /// 請求書日付データ作成  | 
|
| 790 | 
    /// </summary>  | 
|
| 791 | 
    private bool CreateRequestOrderDate(IORequestOrderDate ReqOrderDateDB,  | 
|
| 792 | 
    object[] objRec,  | 
|
| 793 | 
    ConstructionLedgerExcute InRec,  | 
|
| 794 | 
    int nInvoiceNo, int nOrderNo, int nTargetmonth,  | 
|
| 795 | 
    ref string strMsg)  | 
|
| 796 | 
            {
   | 
|
| 797 | 
    try  | 
|
| 798 | 
                {
   | 
|
| 799 | 
    DateTime BillingDate = CommonMotions.cnvDate(objRec[m_DefColumn + (int)InDataOrder.BillingDate]); // 請求日  | 
|
| 800 | 
                    string strDate = string.Format("{0}/{1}/{2}", InRec.TargetMonth.Year, InRec.TargetMonth.Month, BillingDate.Day);
   | 
|
| 801 | 
    DateTime dtReq = DateTime.MinValue;  | 
|
| 802 | 
    if (CommonMotions.chkDate(strDate))  | 
|
| 803 | 
                    {   // 正常時はそのままに日付にする
   | 
|
| 804 | 
    dtReq = DateTime.Parse(strDate); // 請求日  | 
|
| 805 | 
    }  | 
|
| 806 | 
    else  | 
|
| 807 | 
                    {   // エラー時は月末日をセットする
   | 
|
| 808 | 
     | 
|
| 809 | 
    dtReq = new DateTime(InRec.TargetMonth.Year,  | 
|
| 810 | 
    InRec.TargetMonth.Month,  | 
|
| 811 | 
    DateTime.DaysInMonth(InRec.TargetMonth.Year, InRec.TargetMonth.Month));  | 
|
| 812 | 
    }  | 
|
| 813 | 
     | 
|
| 814 | 
    RequestOrderDate DateRec = new RequestOrderDate();  | 
|
| 815 | 
     | 
|
| 816 | 
    DateRec.ConstructionCode = InRec.ConstructionCode; // 工事番号  | 
|
| 817 | 
    DateRec.InvoiceNo = nInvoiceNo; // 請求書番号  | 
|
| 818 | 
    DateRec.SendDate = dtReq; // 請求書発給郵送日  | 
|
| 819 | 
     | 
|
| 820 | 
    if (!ReqOrderDateDB.InsertAction(DateRec, false)) return false;  | 
|
| 821 | 
     | 
|
| 822 | 
    return true;  | 
|
| 823 | 
    }  | 
|
| 824 | 
    catch (Exception ex)  | 
|
| 825 | 
                {
   | 
|
| 826 | 
                    logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
   | 
|
| 827 | 
                    strMsg += string.Format(" システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
   | 
|
| 828 | 
    return false;  | 
|
| 829 | 
    }  | 
|
| 830 | 
    }  | 
|
| 831 | 
    #endregion  | 
|
| 776 | 832 | 
    }  | 
| 777 | 833 | 
    }  | 
他の形式にエクスポート: Unified diff