Monthly data Calculation (in: String typeA/ Numeric type B/ Date type C/ Numeric type D, out: Table type E)

Regarding to the down payment for long-term service, stores sales transfer slip data for the number of months of contract into a data item

    A. Select REMARK STRING DATAData selectStringRequired
    B. Select NUMERIC DATA for Total AmountData selectNumericRequired
    C. Select DATE DATA for Service Start MonthData selectDateRequired
    D. Select NUMERIC DATA for Terms of MonthsData selectNumericRequired
    E. Select TABLE DATA (update)Data selectTableRequired
    F. Set Debits Title (e.g. "Advances")Single-line input
    G. Set Debits Sub-Title (e.g. "Maintenance Service")Single-line input
    H. Set Credits Title (e.g. "Sales")Single-line input
    I. Set Credits Sub-Title (e.g. "Maintenance Service")Single-line input
    -variable namevariable label
    Aconf_DataIdASelect REMARK STRING DATA
    Bconf_DataIdBSelect NUMERIC DATA for Total Amount
    Cconf_DataIdCSelect DATE DATA for Service Start Month
    Dconf_DataIdDSelect NUMERIC DATA for Terms of Months
    Econf_DataIdESelect TABLE DATA (update)
    Fconf_debitsTitleSet Debits Title (e.g. "Advances")
    Gconf_debitsSubTitleSet Debits Sub-Title (e.g. "Maintenance Service")
    Hconf_creditsTitleSet Credits Title (e.g. "Sales")
    Iconf_creditsSubTitleSet Credits Sub-Title (e.g. "Maintenance Service")
    // Transfer Slip Records Generation (ver. 20160908)
    // (c) 2016, Questetra, Inc. (the MIT License)
    //// == 工程コンフィグの参照 / Config Retrieving ==
    var dataIdA = configs.get( "conf_DataIdA" ); // (returns Number)
    var dataIdB = configs.get( "conf_DataIdB" ); // (returns Number)
    var dataIdC = configs.get( "conf_DataIdC" ); // (returns Number)
    var dataIdD = configs.get( "conf_DataIdD" ); // (returns Number)
    var dataIdE = configs.get( "conf_DataIdE" ); // (returns Number)
    var debitsTitle     = configs.get( "conf_debitsTitle" ) + "";
    var debitsSubTitle  = configs.get( "conf_debitsSubTitle" ) + "";
    var creditsTitle    = configs.get( "conf_creditsTitle" ) + "";
    var creditsSubTitle = configs.get( "conf_creditsSubTitle" ) + "";
    //// == ワークフローデータの参照 / Data Retrieving ==
    var remarkString = data.get( dataIdA ) + "";
    var totalAmount = data.get( dataIdB );
    var startMonth = data.get( dataIdC ).getFirstDateInMonth();
    //  startMonth: com.questetra.bpms.util.AddableDate()
    var termsMonth = data.get( dataIdD ) - 0;
    //// == 演算 / Calculating ==
    var monthlyAmount = Math.floor( totalAmount / termsMonth );
    var startAmount = totalAmount - monthlyAmount * (termsMonth -1);
    var myTable = new com.questetra.bpms.core.model.formdata.ListArray();
    for (var i=0; i < termsMonth; i++){
      var tmpRow = new com.questetra.bpms.core.model.formdata.ListArray.ListRow();
      tmpRow.addCol( startMonth.addMonths(i) + "" );
      tmpRow.addCol( debitsTitle );
      tmpRow.addCol( debitsSubTitle );
      if( i === 0 ){
        tmpRow.addCol( startAmount );
        tmpRow.addCol( monthlyAmount );
      tmpRow.addCol( creditsTitle );
      tmpRow.addCol( creditsSubTitle );
      if( i === 0 ){
        tmpRow.addCol( startAmount );
        tmpRow.addCol( monthlyAmount );
      var yyyy_MM = (startMonth.addMonths(i) + "").slice(0,7);
      tmpRow.addCol( yyyy_MM + "_@_" + remarkString );
      myTable.addRow( tmpRow );
    //// == ワークフローデータへの代入 / Data Updating ==
    retVal.put( dataIdE, myTable );

    • A’: “Description” that is stored in the data item selected in A
    • B’: “Amount” that is stored in the data item selected in B
    • C’: “Start Month” that is stored in the data item selected in C
    • D’: “Number of month of Service” that is stored in the data item selected in D
    • Transfer-slips for respective month upon an advance payment received for a long-term service will be stored in Table type Data Item selected in E.
    • Integer values are taken for the Amount. If B’ is indivisible by D’, the reminder below decimal will be added to the next month payment.
    • Table Assumption: Year month information (String type), Debit account title (String column), Debit sub-account title (String column), Debit amount(Numeric column), Credit acount title (String column), Credit sub-account title (String column), Credit amount (Numeric column), Summary title (String column).