<?php

require_once "../../../class/Utils.php";
require_once "../../../class/DBWork.php";
require_once "../../../acct_class/DBAcctReportWork.php";
$acctWork = new DBAcctReportWork(true);
try {
    $acctWork->createWork($_POST, true);
    $res = $acctWork->requestCustomerLedger();
    $gycode = $acctWork->param["gycode"];
    $gycode_calc = false;
    if ((int) ($gycode / 100) == 1 or (int) ($gycode / 100) == 4) {
        $gycode_calc = true;
    }
    $yyyy = (int) substr($acctWork->param["from_yyyymmdd"], 0, 4);
    $tmp_sum = 0;
    $month_credit_sum = 0;
    $month_debit_sum = 0;
    $month_credit_total_sum = 0;
    $month_debit_total_sum = 0;
    $data = array();
    $month = 0;
    $tmp_month = 0;
    if (count($acctWork->result) > 0) {
        while ($item = $acctWork->fetchMapRow()) {
            $jp_yyyymmdd = (int) $item['jp_yyyymmdd'];
            $jp_rem = $item['jp_rem'];
            $customer_id = $item['customer_id'];
            $debit = $item['debit'];
            $credit = $item['credit'];
            $jp_id = $item['jp_id'];
<?php

require_once "../../../class/Utils.php";
require_once "../../../class/DBWork.php";
require_once "../../../acct_class/DBAcctReportWork.php";
$acctWork = new DBAcctReportWork(true);
try {
    $acctWork->createWork($_POST, true);
    $res = $acctWork->requestCustomerList();
    $data = array();
    while ($item = $acctWork->fetchMixedRow()) {
        $searchData['customer_id'] = $item['customer_id'];
        $searchData['customer_id'] = sprintf("%05d", $searchData['customer_id']);
        array_push($data, $searchData);
    }
    $result['CODE'] = '00';
    $result['DATA'] = $data;
    echo json_encode($result);
    $acctWork->destoryWork();
} catch (Exception $e) {
    $acctWork->destoryWork();
    $err = $e->getMessage();
    Util::serverLog($e);
    echo "{ CODE: '99' , DATA : '{$err}'}";
    exit;
}
<?php

require_once "../../../class/Utils.php";
require_once "../../../class/DBWork.php";
require_once "../../../acct_class/DBAcctReportWork.php";
define(DEPRECIATION_COST, 447);
$acctWork = new DBAcctReportWork(true);
try {
    $acctWork->createWork($_POST, true);
    $res = $acctWork->requestBalanceSheetAdv();
    $sum_debit = 0;
    $sum_credit = 0;
    $sum_profit = 0;
    $sum_loss = 0;
    $result = null;
    if (count($acctWork->result) > 0) {
        $result['debit'] = array();
        $result['credit'] = array();
        $result['sum'] = array();
        $result['income'] = array();
        $result['income']['group1'] = array();
        $result['income']['group2'] = array();
        $result['income']['group1_sum'] = array();
        $result['income']['group2_sum'] = array();
        $result['income']['group_sum'] = array();
        while ($item = $acctWork->fetchMixedRow()) {
            $gycode = (int) $item['gycode'];
            $tr_am = $item['tr_am'];
            $obj = null;
            //감가 상각비 무조건 보여주기(0 값이라도)
            if (($tr_am == 0 or $tr_am == '') and $gycode != DEPRECIATION_COST) {
<?php

require_once "../../../class/Utils.php";
require_once "../../../class/DBWork.php";
require_once "../../../acct_class/DBAcctReportWork.php";
$acctWork = new DBAcctReportWork(true);
try {
    $acctWork->createWork($_POST, true);
    $res = $acctWork->requestCustomerBalance();
    $data = array();
    $sum_gicho = 0;
    $sum_credit = 0;
    $sum_debit = 0;
    $sum_rest = 0;
    $gycode = $_POST['gycode'];
    while ($item = $acctWork->fetchMapRow()) {
        $gicho = $item['gicho'];
        $credit = $item['value_credit'];
        $debit = $item['value_debit'];
        if ($gicho == 0 and $credit == 0 and $debit == 0) {
            continue;
        }
        if ((int) ($gycode / 100) == 2 or (int) ($gycode / 100) == 3) {
            $rest = $gicho + $credit - $debit;
        } else {
            $rest = $gicho + $debit - $credit;
        }
        $sum_gicho += $gicho;
        $sum_credit += $credit;
        $sum_debit += $debit;
        $sum_rest += $rest;
<?php

require_once "../../../class/Utils.php";
require_once "../../../class/DBWork.php";
require_once "../../../acct_class/DBAcctReportWork.php";
$acctWork = new DBAcctReportWork(true);
try {
    $acctWork->createWork($_GET, true);
    $res = $acctWork->requestAcctReportMonthList();
    $item = $acctWork->fetchMixedRow();
    $type1 = array('gycode' => '자산', 'balance_am' => '', 'type' => -1, 'r_credit' => '', 'r_debit' => '', 'balance' => '');
    $type1['children'] = array();
    $type2 = array('gycode' => '부채', 'balance_am' => '', 'type' => -1, 'r_credit' => '', 'r_debit' => '', 'balance' => '');
    $type2['children'] = array();
    $type3 = array('gycode' => '수익', 'balance_am' => '', 'type' => -1, 'r_credit' => '', 'r_debit' => '', 'balance' => '');
    $type3['children'] = array();
    $type4 = array('gycode' => '비용', 'balance_am' => '', 'type' => -1, 'r_credit' => '', 'r_debit' => '', 'balance' => '');
    $type4['children'] = array();
    $c_debit = $res['c_debit'];
    $c_credit = $res['c_credit'];
    if (count($acctWork->result) > 0) {
        while (true) {
            $gycode = (int) $item['gycode'];
            $gicho_debit = $item['gicho_debit'];
            $gicho_credit = $item['gicho_credit'];
            $sum_credit = $item['sum_credit'];
            $sum_debit = $item['sum_debit'];
            $r_debit = $item['r_debit'];
            $r_credit = $item['r_credit'];
            $sum = 0;
            if ($gycode == 101) {
<?php

require_once "../../../class/Utils.php";
require_once "../../../class/DBWork.php";
require_once "../../../acct_class/DBAcctReportWork.php";
$acctWork = new DBAcctReportWork(true);
try {
    $acctWork->createWork($_POST, true);
    $res = $acctWork->requestCashReportDM();
    $yyyy = (int) substr($acctWork->param["from_yyyymmdd"], 0, 4);
    $flag = $acctWork->param["flag"];
    $tmp_sum = 0;
    $month_credit_sum = 0;
    $month_debit_sum = 0;
    $month_credit_total_sum = 0;
    $month_debit_total_sum = 0;
    $data = array();
    $month = 0;
    $tmp_month = 0;
    $gicho_credit = 0;
    $gicho_debit = 0;
    if (count($acctWork->result) > 0) {
        while ($item = $acctWork->fetchMapRow()) {
            $jp_yyyymmdd = (int) $item['jp_yyyymmdd'];
            $jp_rem = $item['jp_rem'];
            //$customer_id = $item['customer_id'];
            $item['customer_id'] = sprintf("%05d", $item['customer_id']);
            $debit = $item['debit'];
            $credit = $item['credit'];
            $jp_id = $item['jp_id'];
            $jp_no = $item['jp_no'];
<?php

require_once "../../../class/Utils.php";
require_once "../../../class/DBWork.php";
require_once "../../../acct_class/DBAcctReportWork.php";
$acctWork = new DBAcctReportWork(true);
try {
    $acctWork->createWork($_POST, true);
    $col_array = $acctWork->requestProfitReport();
    $item = $acctWork->fetchMapRow();
    $sum_array = array();
    $result = array();
    if (count($acctWork->result) > 0) {
        while (true) {
            $gycode = (int) $item['gycode'];
            //계산
            $calc = $gycode > 399;
            $group = (int) ($gycode / 100);
            $item['group'] = $group;
            $sum = 0;
            $checksum = 0;
            for ($idx = 0; $idx < count($col_array); $idx = $idx + 3) {
                $col1 = $col_array[$idx];
                $col2 = $col_array[$idx + 1];
                $col3 = $col_array[$idx + 2];
                $Cvalue = $item[$col1];
                $Dvalue = $item[$col2];
                $key = $col3;
                $checksum = $checksum + $Cvalue + $Dvalue;
                if (!$calc) {
                    $Cvalue = $Cvalue - $Dvalue;
<?php

require_once "../../../class/Utils.php";
require_once "../../../class/DBWork.php";
require_once "../../../acct_class/DBAcctReportWork.php";
$acctWork = new DBAcctReportWork(true);
try {
    $acctWork->createWork($_POST, true);
    $res = $acctWork->requestMonthProfitGycodeReport();
    $gycode = $acctWork->param["gycode"];
    $gycode_calc = false;
    if ((int) ($gycode / 100) == 1 or (int) ($gycode / 100) == 4) {
        $gycode_calc = true;
    }
    $yyyy = (int) substr($acctWork->param["from_yyyymmdd"], 0, 4);
    $tmp_sum = 0;
    $month_credit_sum = 0;
    $month_debit_sum = 0;
    $month_credit_total_sum = 0;
    $month_debit_total_sum = 0;
    $data = array();
    $month = 0;
    $tmp_month = 0;
    if (count($acctWork->result) > 0) {
        while ($item = $acctWork->fetchMapRow()) {
            $jp_yyyymmdd = (int) $item['jp_yyyymmdd'];
            $jp_rem = $item['jp_rem'];
            $customer_id = $item['customer_id'];
            $debit = $item['debit'];
            $credit = $item['credit'];
            $jp_id = $item['jp_id'];
<?php

require_once "../../../class/Utils.php";
require_once "../../../class/DBWork.php";
require_once "../../../acct_class/DBAcctReportWork.php";
$acctWork = new DBAcctReportWork(true);
try {
    //파라미터
    //$jp_yyyymmdd = (int)$this->param['jp_yyyymmdd'];
    //$jp_no = (int)$this->param['jp_no'];
    //$gycode = (int)$this->param['gycode'];
    $acctWork->createWork($_POST, true);
    $res = $acctWork->requestCreditSPDetail();
    $result = array();
    while ($item = $acctWork->fetchMapRow()) {
        $item['io_item_cd'] = sprintf("%05d", $item['io_item_cd']);
        array_push($result, $item);
    }
    echo "{ CODE: '00' , DATA : " . json_encode($result) . "}";
    $acctWork->destoryWork();
} catch (Exception $e) {
    $acctWork->destoryWork();
    $err = $e->getMessage();
    Util::serverLog($e);
    echo "{ CODE: '99' , DATA : '{$err}'}";
    exit;
}