2021年3月11日星期四

How to assign entry type for two different parameters

I wanna ask how can I assign entry type 10 for the account receivable and 20 for account payable in array, because my api is using xml so i need to pass array into it.

This is my database look

NAME|Purchase|  Sales | Tax | Discount | EntryType|  AR  | 303-00 | 200-00 | 6.0 |    3.0   |    10    |  AP  | 200-00 | 800-00 | 4.0 |    2.0   |    20    |  

When I insert it will save into the same table but differentiate them with the entry type. Im failed to pass the data at array there. I dont know how to assign specific value for them. Anyone please help me? Stuck at this question very long time already.

$(document).ready(function() {        $("#btnUpdateAccControl").click(function(e) {              var arrayItem = [];            var sArrayItem = "";  // at here how can I assign entry type 10 for the account receivable and 20 for account payable in array, because my api is using xml so i need to pass array into it.            $(.row),function(index, value) {                let item = {                Purchase: $(".col-purchase").val(),                Sales: $(".col-sales").val(),                Tax: $(".col-tax").val(),                Discount: $(".col-discount").val(),              }              arrayItem.push(item)            }); console.log(arrayItem)            sArrayItem = JSON.stringify(arrayItem);            $.ajax({            type: "POST",            url: "UpdateAccControl",            data: JSON.stringify({              sArrayItem            }),            contentType: "application/json; charset=utf-8",            dataType: "json",            success: function(result) {              if (result.d.indexOf(".aspx") != -1)                window.location.href = result.d;              else                showPopup(result);            },            failure: function(response) {              alert(response.d);            }          });        });
<!-- Row -->  <div class="row">    <div class="col-lg-12 col-md-12">      <div class="card custom-card">        <div class="card-body">          <div class="row">            <div class="col-md-6">              <h5>Account Receivable</h5>              <hr />              <div class="form-group text-left">                <label>Purchase</span></label>                <input class="form-control col-purchase" type="text" required>              </div>              <div class="form-group text-left">                <label>Sales</label>                <input class="form-control col-sales" type="text" required>              </div>              <div class="form-group text-left">                <label>Tax</label>                <input class="form-control col-tax" type="text" required>              </div>              <div class="form-group text-left">                <label>Discount</label>                <input class="form-control col-discount" type="text" required>              </div>            </div>            <div class="col-md-6">              <h5>Account Payable</h5>              <hr />              <div class="form-group text-left">                <label>Purchase</span></label>                <input class="form-control col-purchase" type="text" required>              </div>              <div class="form-group text-left">                <label>Sales</label>                <input class="form-control col-sales" type="text" required>              </div>              <div class="form-group text-left">                <label>Tax</label>                <input class="form-control col-tax" type="text" required>              </div>              <div class="form-group text-left">                <label>Discount</label>                <input class="form-control col-discount" type="text" required>              </div>            </div>          </div>          <div class="card-footer">            <div class="btn ripple btn-info" id='btnUpdateAccControl'><i class="fe fe-plus-circle"></i>            </div>          </div>        </div>      </div>    </div>  </div>  <!-- End Row -->
https://stackoverflow.com/questions/66589757/how-to-assign-entry-type-for-two-different-parameters March 12, 2021 at 04:04AM

没有评论:

发表评论