当前位置: 首页>>代码示例>>PHP>>正文


PHP Spreadsheet_Excel_Reader::setRowColOffset方法代码示例

本文整理汇总了PHP中Spreadsheet_Excel_Reader::setRowColOffset方法的典型用法代码示例。如果您正苦于以下问题:PHP Spreadsheet_Excel_Reader::setRowColOffset方法的具体用法?PHP Spreadsheet_Excel_Reader::setRowColOffset怎么用?PHP Spreadsheet_Excel_Reader::setRowColOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Spreadsheet_Excel_Reader的用法示例。


在下文中一共展示了Spreadsheet_Excel_Reader::setRowColOffset方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: uploadScore

 function uploadScore($exam_paper)
 {
     $this->exam->id = $exam_paper;
     if ($this->input->post('submit')) {
         try {
             if ($_FILES['score_table']['error'] > 0) {
                 throw new Exception('文件上错错误:错误代码: ' . $_FILES['score_table']['error']);
             }
             if (!(preg_match('/\\.(\\w*?)$/', $_FILES['score']['name'], $extname_match) && $extname_match[1] == 'xls')) {
                 throw new Exception('文件格式错误,请上传xls格式的excel表格');
             }
             require APPPATH . 'third_party/PHP-ExcelReader/reader.php';
             $data = new Spreadsheet_Excel_Reader();
             $data->setOutputEncoding('utf-8');
             $data->setRowColOffset(0);
             $data->read($_FILES['score']['tmp_name']);
             $this->exam->uploadScore($data);
         } catch (Exception $e) {
             $this->output->message($e->getMessage(), 'warning');
         }
     }
     $this->load->view('exam/uploadscore');
 }
开发者ID:flyingfish2013,项目名称:Syssh,代码行数:23,代码来源:exam.php

示例2: InsertData

function InsertData()
{
    if (!empty($_FILES['attach']['name'])) {
        $data = new Spreadsheet_Excel_Reader();
        $data->setOutputEncoding('utf-8');
        $data->setRowColOffset(0);
        $data->read($_FILES["attach"]["tmp_name"]);
    }
    $log_obj = new manage_group_pay_get_log();
    $FileType = $_POST["PayType"];
    $PayYear = $_POST["pay_year"];
    $PayMonth = $_POST["pay_month"];
    $SID = $_POST["sid"];
    $success_count = 0;
    $unsuccess_count = 0;
    //.......ماموریت.......................................................
    if ($FileType == 8) {
        if (empty($_FILES['attach']['name'])) {
            $SDate = $PayYear . "/" . $PayMonth . "/01";
            if ($PayMonth < 7) {
                $endDay = "31";
            } elseif ($PayMonth > 6 && $PayMonth < 12) {
                $endDay = "30 ";
            } elseif ($PayMonth == 12) {
                $endDay = "29";
            }
            $EDate = $PayYear . "/" . $PayMonth . "/" . $endDay;
            $pdo = PdoDataAccess::getPdoObject();
            $pdo->beginTransaction();
            $query = "\tSELECT staff_id , duration , region_coef , salary_item_type_id , mli.list_id , mli.list_row_no \n\n\t\t\t\t\t\t\tFROM pay_get_lists pgl inner join mission_list_items mli\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ton pgl.list_id = mli.list_id\n\n\t\t\t\t\t\t\t\t\t\t\t\twhere list_type = 9 and pgl.list_date >= '" . DateModules::shamsi_to_miladi($SDate) . "' and\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tpgl.list_date <= j2g({$PayYear},{$PayMonth},{$endDay}) and doc_state = 3 ";
            //".DateModules::shamsi_to_miladi($EDate) ."
            $res = PdoDataAccess::runquery($query);
            for ($i = 0; $i < count($res); $i++) {
                $PaymentObj = new manage_payments();
                $PayItmObj = new manage_payment_items();
                $query = " select staff_id , bank_id , account_no , last_cost_center_id , person_type  \n\t\t\t\t\t\t                from hrmstotal.staff where staff_id =" . $res[$i]['staff_id'];
                $resStf = PdoDataAccess::runquery($query);
                if (!isset($resStf[0]['bank_id']) || !($resStf[0]['bank_id'] > 0)) {
                    $log_obj->make_unsuccess_rows($res[$i]['staff_id'], "-", "بانک فرد جهت پرداخت مشخص نمی باشد.");
                    $unsuccess_count++;
                    continue;
                }
                if (!($resStf[0]['account_no'] > 0)) {
                    $log_obj->make_unsuccess_rows($res[$i]['staff_id'], "-", "شماره حساب فرد جهت پرداخت مشخص نمی باشد.");
                    $unsuccess_count++;
                    continue;
                }
                if (!($resStf[0]['last_cost_center_id'] > 0)) {
                    $log_obj->make_unsuccess_rows($res[$i]['staff_id'], "-", "آخرین مرکز هزینه فرد مشخص نشده است.");
                    $unsuccess_count++;
                    continue;
                }
                //......... محاسبه ماموریت............................
                $coef = !empty($res[$i]['region_coef']) ? $res[$i]['region_coef'] : 0;
                $param1 = 0;
                $missionValue = manage_payment_calculation::calculate_mission($res[$i]['staff_id'], $PayYear, $PayMonth, $res[$i]['duration'], $coef, $param1);
                /*if($res[$i]['staff_id'] == 882660 ) {
                 echo "----".$missionValue ;  	 die() ;  }*/
                //....................................................
                $PaymentObj->staff_id = $res[$i]['staff_id'];
                $PaymentObj->pay_year = $PayYear;
                $PaymentObj->pay_month = $PayMonth;
                $PaymentObj->payment_type = $FileType;
                $PaymentObj->bank_id = $resStf[0]['bank_id'];
                $PaymentObj->account_no = $resStf[0]['account_no'];
                $PaymentObj->state = 2;
                unset($payRes);
                /*if( $resStf[0]['person_type'] == 1 || $resStf[0]['person_type'] == 2 || $resStf[0]['person_type'] == 3 ) 
                			$DB = "hrms.";
                		else 
                			$DB = "hrms_sherkati."; */
                $qry = " select count(*) cn  \n\t\t\t\t\t\t\t\t\tfrom payments \n\t\t\t\t\t\t\t\t\t\t\twhere pay_year = " . $PayYear . " and pay_month = " . $PayMonth . " and staff_id = " . $PaymentObj->staff_id . " and payment_type = " . $FileType;
                $payRes = PdoDataAccess::runquery($qry);
                if ($payRes[0]['cn'] == 0) {
                    if ($PaymentObj->Add($pdo) === false) {
                        $log_obj->make_unsuccess_rows($res[$i]['staff_id'], "-", "خطا در ثبت  فیش ماموریت");
                        $unsuccess_count++;
                        continue;
                    }
                    if ($resStf[0]['person_type'] == 1) {
                        $SID = 42;
                    }
                    if ($resStf[0]['person_type'] == 2) {
                        $SID = 43;
                    }
                    if ($resStf[0]['person_type'] == 3) {
                        $SID = 10315;
                    }
                    if ($resStf[0]['person_type'] == 5) {
                        $SID = 643;
                    }
                    //$SID = $res[$i]['salary_item_type_id'] ;
                    //............ مرکز هزینه .....................
                    $PayItmObj->pay_year = $PayYear;
                    $PayItmObj->pay_month = $PayMonth;
                    $PayItmObj->param1 = $param1;
                    $PayItmObj->staff_id = $res[$i]['staff_id'];
                    $PayItmObj->salary_item_type_id = $SID;
                    $PayItmObj->pay_value = $missionValue;
                    $PayItmObj->cost_center_id = $resStf[0]['last_cost_center_id'];
//.........这里部分代码省略.........
开发者ID:jafarkhani,项目名称:rtfund,代码行数:101,代码来源:non_salary_import.data.php

示例3: ImportHolidaysFromExcel

function ImportHolidaysFromExcel()
{
    require_once inc_phpExcelReader;
    $data = new Spreadsheet_Excel_Reader();
    $data->setOutputEncoding('utf-8');
    $data->setRowColOffset(0);
    $data->read($_FILES["attach"]["tmp_name"]);
    for ($i = 0; $i < $data->sheets[0]['numRows']; $i++) {
        $row = $data->sheets[0]['cells'][$i];
        $obj = new ATN_holidays();
        $obj->TheDate = DateModules::shamsi_to_miladi($row[0]);
        $obj->details = $row[1];
        $result = $obj->Add();
    }
    echo Response::createObjectiveResponse($result, "");
    die;
}
开发者ID:jafarkhani,项目名称:rtfund,代码行数:17,代码来源:shift.data.php

示例4: Equalization_UpdateChecks

function Equalization_UpdateChecks()
{
    $BankID = $_POST["BankID"];
    $result = "";
    require_once "phpExcelReader.php";
    $data = new Spreadsheet_Excel_Reader();
    $data->setOutputEncoding('utf-8');
    $data->setRowColOffset(0);
    $data->read($_FILES["attach"]["tmp_name"]);
    $pdo = PdoDataAccess::getPdoObject();
    $pdo->beginTransaction();
    //--------------- add to equalizations -------------
    $EqualObj = new ACC_equalizations();
    $EqualObj->RegDate = PDONOW;
    $EqualObj->BankID = $BankID;
    $EqualObj->ImportFile = fread(fopen($_FILES["attach"]["tmp_name"], 'r'), $_FILES["attach"]["size"]);
    $EqualObj->Add($pdo);
    //----------- insert DocHeader --------------------
    $obj = new ACC_docs();
    $obj->RegDate = PDONOW;
    $obj->regPersonID = $_SESSION['USER']["PersonID"];
    $obj->DocDate = PDONOW;
    $obj->CycleID = $_SESSION["accounting"]["CycleID"];
    $obj->BranchID = $_SESSION["accounting"]["BranchID"];
    $obj->DocType = DOCTYPE_EQUALCHECKS;
    $obj->description = "مغایرت گیری بانکی / به روز رسانی چک ها ";
    if (!$obj->Add($pdo)) {
        ExceptionHandler::PushException("خطا در ایجاد سند");
        return false;
    }
    $successCount = 0;
    for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
        $checkNo = "";
        switch ($BankID) {
            case "4":
                // اقتصاد نوین
                $TafsiliID = "";
                $TafsiliID2 = "";
                if (empty($data->sheets[0]['cells'][$i][1])) {
                    continue;
                }
                $cellData = $data->sheets[0]['cells'][$i][1];
                if (isset($cellData) && strpos(trim($cellData), "چک عادي ش.") !== false) {
                    $arr = preg_split("/\\//", $cellData);
                    $checkNo = $arr[2];
                    $checkNo = substr($checkNo, 0, strpos($checkNo, "صندوق پژوهش"));
                }
                break;
        }
        if ($checkNo == "") {
            continue;
        }
        //---------------- add doc items --------------------
        $dt = PdoDataAccess::runquery("\r\n\t\t\tSELECT * FROM ACC_IncomeCheques \r\n\t\t\t\twhere ChequeNo=? AND ChequeStatus<>" . INCOMECHEQUE_VOSUL, array($checkNo), $pdo);
        if (count($dt) > 0) {
            $inChequeObj = new ACC_IncomeCheques($dt[0]["IncomeChequeID"]);
            $inChequeObj->EqualizationID = $EqualObj->EqualizationID;
            $inChequeObj->ChequeStatus = INCOMECHEQUE_VOSUL;
            $inChequeObj->Edit($pdo);
            $temp = $inChequeObj->GetBackPays($pdo);
            foreach ($temp as $row) {
                $BackPayObj = new LON_BackPays($row["BackPayID"]);
                $BackPayObj->EqualizationID = $EqualObj->EqualizationID;
                $BackPayObj->Edit($pdo);
            }
            ACC_IncomeCheques::AddToHistory($inChequeObj->IncomeChequeID, $inChequeObj->ChequeStatus, $pdo);
            RegisterOuterCheque($obj->DocID, $inChequeObj, $pdo, COSTID_Bank, $TafsiliID, $TafsiliID2);
            $successCount++;
            $result .= "شماره چک : " . $checkNo . " به روز رسانی شد <br>";
        } else {
            $result .= "<font color=red> شماره چک : " . $checkNo . " یافت نشد </font><br>";
        }
    }
    if ($successCount == 0) {
        $pdo->rollBack();
    } else {
        $pdo->commit();
    }
    echo Response::createObjectiveResponse(true, $successCount == 0 ? "هیچ چکی به روز نگردید" : $result);
    die;
}
开发者ID:jafarkhani,项目名称:rtfund,代码行数:81,代码来源:operation.data.php

示例5: importAction

 public function importAction()
 {
     $result = array('success' => true, 'info' => '导入成功');
     $request = $this->getRequest()->getParams();
     $now = date('Y-m-d H:i:s');
     if (isset($_FILES['csv'])) {
         $now = date('Y-m-d H:i:s');
         $user_session = new Zend_Session_Namespace('user');
         $user_id = $user_session->user_info['user_id'];
         $file = $_FILES['csv'];
         $file_extension = strrchr($file['name'], ".");
         $h = new Application_Model_Helpers();
         $tmp_file_name = $h->getMicrotimeStr() . $file_extension;
         $savepath = "../temp/";
         $tmp_file_path = $savepath . $tmp_file_name;
         move_uploaded_file($file["tmp_name"], $tmp_file_path);
         $plist = new Product_Model_Productlist();
         // 读取文件
         require_once LIBRARY_PATH . "/Excel/reader.php";
         $reader = new Spreadsheet_Excel_Reader();
         $reader->setOutputEncoding('UTF-8');
         $reader->setUTFEncoder('mb');
         $reader->setRowColOffset(1);
         $reader->read($tmp_file_path);
         error_reporting(E_ALL ^ E_NOTICE);
         $data = array();
         for ($i = 1; $i <= $reader->sheets[0]['numRows']; $i++) {
             $row = array();
             for ($j = 1; $j <= $reader->sheets[0]['numCols']; $j++) {
                 $row[] = $reader->sheets[0]['cells'][$i][$j];
             }
             $data[] = $row;
         }
         // 数据校验
         if (count($data) <= 1) {
             $result['success'] = false;
             $result['info'] = "文件中无数据!";
             echo Zend_Json::encode($result);
             exit;
         }
         $cols = array("sn", "code", "step", "description", "is_bom_exists", "bom_apply_time", "bom_archive_time", "product_code", "bosa", "bosa_supply", "tosa", "tosa_supply", "rosa", "rosa_supply", "pcb", "pcba", "dg02", "dg01", "product_label", "barcode_label", "label_print_rule", "tooling_model", "sample_send_time", "pra", "trial_produce_qa1", "pmr", "dl", "ipa", "cri", "ds", "dd", "pl", "pes", "pcb_file", "icd", "smt", "mp", "sqr", "dvs", "dvp", "dvr", "dvt", "rtr", "emr", "mtb", "tsq", "sqc", "ed", "pts", "sp", "ep", "fep", "fsp", "ld", "pd", "pg", "nfc", "frm", "pfc", "wi", "other", "create_time", "create_user", "update_time", "update_user");
         for ($i = 1; $i < count($data); $i++) {
             $num = $i + 1;
             $row = $data[$i];
             if (count($row) < 2 || !$row[1]) {
                 continue;
             }
             $code = $row[1];
             if (!$this->checkExists($code)) {
                 $insertData = array();
                 $k = 0;
                 foreach ($cols as $c) {
                     $insertData[$c] = $row[$k];
                     $k++;
                 }
                 try {
                     $plist->insert($insertData);
                 } catch (Exception $e) {
                     $result['result'] = false;
                     $result['info'] = $e->getMessage();
                     echo Zend_Json::encode($result);
                     exit;
                 }
             } else {
                 $errors[] = $code;
             }
         }
         $result['error'] = $errors;
     }
     echo Zend_Json::encode($result);
     exit;
 }
开发者ID:xindalu,项目名称:evolve,代码行数:72,代码来源:ProductlistController.php

示例6: UpdateChecks

function UpdateChecks()
{
    $AccountID = $_POST["AccountID"];
    $result = "";
    require_once "phpExcelReader.php";
    $data = new Spreadsheet_Excel_Reader();
    $data->setOutputEncoding('utf-8');
    $data->setRowColOffset(0);
    $data->read($_FILES["attach"]["tmp_name"]);
    for ($i = 0; $i < $data->sheets[0]['numRows']; $i++) {
        $CheckNo = "";
        switch ($AccountID) {
            case "1":
                // ملی
                if (trim($data->sheets[0]['cells'][$i][3]) == "چك") {
                    $CheckNo = $data->sheets[0]['cells'][$i][4];
                    $CheckNo = substr($CheckNo, strlen($CheckNo) - 6);
                }
                break;
            case "5":
                //پاسارگاد
                if (strpos($data->sheets[0]['cells'][$i][8], "وصول چک") !== false) {
                    $CheckNo = $data->sheets[0]['cells'][$i][7];
                    $CheckNo = substr($CheckNo, strlen($CheckNo) - 6);
                }
        }
        if ($CheckNo == "") {
            continue;
        }
        //............... add debtor rows to doc ...........................
        if ($_POST["DocID"] != "") {
            $dt = PdoDataAccess::runquery("select * from ACC_DocCheques \n\t\t\t\twhere CheckStatus in(1,2) AND AccountID=? AND CheckNo=?", array($AccountID, $CheckNo));
            if (count($dt) > 0) {
                $obj = new ACC_DocItems();
                $obj->DocID = $_POST["DocID"];
                $obj->kolID = 42;
                // اسناد پرداختنی
                $obj->moinID = 1;
                // کوتاه مدت
                $obj->TafsiliID = $dt[0]["TafsiliID"];
                $obj->DebtorAmount = $dt[0]["amount"];
                $obj->CreditorAmount = 0;
                $obj->Add();
            }
        }
        //..................................................................
        PdoDataAccess::runquery("update ACC_DocCheques set CheckStatus=3 where AccountID=? AND CheckNo=?", array($AccountID, $CheckNo));
        if (PdoDataAccess::AffectedRows() > 0) {
            $result .= "شماره چک : " . $CheckNo . " [ تعداد ردیف به روز شده : " . PdoDataAccess::AffectedRows() . "]<br>";
        }
    }
    echo Response::createObjectiveResponse(true, $result == "" ? "هیچ چکی به روز نگردید" : $result);
    die;
    while (($row = fgetcsv($handle)) !== false) {
        $row[3] = iconv(mb_detect_encoding($row[3], mb_detect_order(), true), "UTF-8", $row[3]);
        echo $row[3] . "-------";
        if (trim($row[3]) == "چك") {
            echo $row[4] . "*********";
            $CheckNo = substr($row[4], 4);
            PdoDataAccess::runquery("update ACC_DocCheques set CheckStatus=2 where AccountID=? AND CheckNo=?", array($AccountID, (int) $CheckNo));
            if (PdoDataAccess::AffectedRows() > 0) {
                $result .= "شماره چک : " . $CheckNo . " [ تعداد ردیف به روز شده : " . PdoDataAccess::AffectedRows() . "]<br>";
            }
        }
    }
    fclose($handle);
    echo Response::createObjectiveResponse(true, $result == "" ? "هیچ چکی به روز نگردید" : $result);
    die;
}
开发者ID:jafarkhani,项目名称:rtfund,代码行数:69,代码来源:doc.data.php

示例7: pathinfo

}
if (is_uploaded_file($_FILES['userfile']['tmp_name']) === TRUE and isset($annettuvuosi) and $annettuvuosi != 0 and isset($tilinumero) and trim($tilinumero) != '' and $tee == 'LUO') {
    $path_parts = pathinfo($_FILES['userfile']['name']);
    $ext = strtoupper($path_parts['extension']);
    if ($ext != "XLS") {
        die("<font class='error'><br>" . t("Ainoastaan .xls tiedostot sallittuja") . "!</font>");
    }
    if ($_FILES['userfile']['size'] == 0) {
        die("<font class='error'><br>" . t("Tiedosto on tyhjä") . "!</font>");
    }
    require_once 'excel_reader/reader.php';
    // ExcelFile
    $data = new Spreadsheet_Excel_Reader();
    // Set output Encoding.
    $data->setOutputEncoding('CP1251');
    $data->setRowColOffset(0);
    $data->read($_FILES['userfile']['tmp_name']);
    echo "<font class='message'>" . t("Tarkastetaan lähetetty tiedosto") . "...<br><br></font>";
    echo "<form method='post'>";
    // luetaan eka rivi tiedostosta..
    $headers = array();
    for ($excej = 0; $excej < $data->sheets[0]['numCols']; $excej++) {
        $headers[] = strtoupper(trim($data->sheets[0]['cells'][0][$excej]));
    }
    // Poistetaan tyhjät headerit oikealta
    for ($excej = 0; $excej = count($headers) - 1; $excej--) {
        if ($headers[$excej] != "") {
            break;
        } else {
            unset($headers[$excej]);
        }
开发者ID:Hermut,项目名称:pupesoft,代码行数:31,代码来源:viranomaistuotteet.php

示例8: InsertData

function InsertData()
{
    $data = new Spreadsheet_Excel_Reader();
    $data->setOutputEncoding('utf-8');
    $data->setRowColOffset(0);
    $data->read($_FILES["attach"]["tmp_name"]);
    $FileType = $_POST["FileType"];
    $obj = new manage_pay_get_lists();
    $MissionObj = new manage_mission_list_items();
    $PGIObj = new manage_pay_get_list_items();
    $log_obj = new manage_group_pay_get_log();
    $success_count = 0;
    $unsuccess_count = 0;
    $costId = "";
    if ($FileType == EXTRA_WORK_LIST) {
        for ($i = 1; $i < $data->sheets[0]['numRows']; $i++) {
            //for ($j = 0; $j < $data->sheets[0]['numCols']; $j++)
            //$data->sheets[0]['cells'][$i][$j];
            if (!isset($data->sheets[0]['cells'][$i][0]) && !isset($data->sheets[0]['cells'][$i][1])) {
                break;
            }
            $query = " select p.pfname , p.plname , s.person_type from staff s inner join persons p on s.personid = p.personid\n\t\t\t\t\twhere staff_id =" . $data->sheets[0]['cells'][$i][1];
            $result = PdoDataAccess::runquery($query);
            if ($costId != $data->sheets[0]['cells'][$i][0]) {
                $obj->list_id = null;
                $obj->cost_center_id = $data->sheets[0]['cells'][$i][0];
                $obj->list_date = DateModules::Now();
                $obj->doc_state = 1;
                $obj->list_type = EXTRA_WORK_LIST;
                if ($obj->AddList() === false) {
                    $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][1], $result[0]["pfname"] . " " . $result[0]["plname"], " کد مرکز هزینه نامعتبر است.");
                    $unsuccess_count++;
                    continue;
                }
                $costId = $obj->cost_center_id;
            }
            if (count($result) > 0) {
                $pt = $result[0]["person_type"];
                if ($pt == 3) {
                    $salaryItemId = 152;
                } elseif ($pt == 2) {
                    $salaryItemId = 39;
                } elseif ($pt == 5) {
                    $salaryItemId = 639;
                }
                $PGIObj->staff_id = $data->sheets[0]['cells'][$i][1];
                $PGIObj->salary_item_type_id = $salaryItemId;
                $PGIObj->approved_amount = $data->sheets[0]['cells'][$i][2];
                $PGIObj->comments = $data->sheets[0]['cells'][$i][3];
                $PGIObj->list_id = $obj->GetLastID("pay_get_lists", "list_id", " list_type = 1 and cost_center_id =" . $obj->cost_center_id);
                $PGIObj->list_row_no = $PGIObj->GetLastID("pay_get_list_items", "list_row_no", " list_id =" . $PGIObj->list_id) + 1;
                if ($PGIObj->Add() == false) {
                    $log_obj->make_unsuccess_rows($PGIObj->staff_id);
                    $unsuccess_count++;
                }
            } else {
                $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][1], " ", "شماره شناسایی نامعتبر است.");
                $unsuccess_count++;
            }
        }
        $log_obj->finalize();
        $st = preg_replace('/\\r\\n/', "", $log_obj->make_result());
        echo "{success:true,data:'" . $st . "'}";
        die;
    } elseif ($FileType == MISSION_LIST) {
        for ($i = 1; $i < $data->sheets[0]['numRows']; $i++) {
            //for ($j = 0; $j < $data->sheets[0]['numCols']; $j++)
            //$data->sheets[0]['cells'][$i][$j];
            $query = " select p.pfname , p.plname , s.person_type from staff s inner join persons p on s.personid = p.personid\n\t\t\t\t\twhere staff_id =" . $data->sheets[0]['cells'][$i][1];
            $result = PdoDataAccess::runquery($query);
            if ($costId != $data->sheets[0]['cells'][$i][0]) {
                $obj->list_id = null;
                $obj->cost_center_id = $data->sheets[0]['cells'][$i][0];
                $obj->list_date = DateModules::Now();
                $obj->doc_state = 1;
                $obj->list_type = MISSION_LIST;
                if ($obj->AddList() === false) {
                    $log_obj->make_unsuccess_rows($data->sheets[0]['cells'][$i][1], $result[0]["pfname"] . " " . $result[0]["plname"], " کد مرکز هزینه نامعتبر است.");
                    $unsuccess_count++;
                    continue;
                }
                $costId = $obj->cost_center_id;
            }
            if (count($result) > 0) {
                $pt = $result[0]["person_type"];
                if ($pt == 1) {
                    $salaryItemId = 42;
                } elseif ($pt == 2) {
                    $salaryItemId = 43;
                } elseif ($pt == 3) {
                    $salaryItemId = 10315;
                } elseif ($pt == 5) {
                    $salaryItemId = 643;
                }
                $MissionObj->staff_id = $data->sheets[0]['cells'][$i][1];
                $MissionObj->doc_no = $data->sheets[0]['cells'][$i][2];
                $MissionObj->doc_date = DateModules::shamsi_to_miladi($data->sheets[0]['cells'][$i][3]);
                $MissionObj->from_date = DateModules::shamsi_to_miladi($data->sheets[0]['cells'][$i][4]);
                $MissionObj->to_date = DateModules::shamsi_to_miladi($data->sheets[0]['cells'][$i][5]);
                $MissionObj->duration = $data->sheets[0]['cells'][$i][6];
//.........这里部分代码省略.........
开发者ID:jafarkhani,项目名称:rtfund,代码行数:101,代码来源:upload_excel.data.php

示例9: uploadBoard

 function uploadBoard()
 {
     $this->load->model('exam_model', 'exam');
     $examArray = $this->exam->getInfoList();
     $this->load->addViewData('examArray', $examArray);
     if ($this->input->get('exam_paper')) {
         foreach ($examArray as $exam) {
             if ($exam['exam_paper'] == intval($this->input->get('exam_paper'))) {
                 $currentExam = $exam;
             }
         }
     } elseif (!empty($examArray) > 0) {
         $currentExam = $examArray[0];
     } else {
         $currentExam = false;
     }
     $this->load->addViewData('currentExam', $currentExam);
     while ($submit == 'score_table') {
         if ($_FILES['score_table']['error'] > 0) {
             showMessage('文件上错错误:错误代码: ' . $_FILES['score_table']['error'], 'warning');
             break;
         }
         if (!(preg_match('/\\.(\\w*?)$/', $_FILES['score_table']['name'], $extname_match) && $extname_match[1] == 'xls')) {
             showMessage('文件格式错误,请上传xls格式的excel表格', 'warning');
             break;
         }
         require APPPATH . 'third_party/PHP-ExcelReader/reader.php';
         $data = new Spreadsheet_Excel_Reader();
         $data->setOutputEncoding('utf-8');
         $data->setRowColOffset(0);
         $data->read($_FILES['score_table']['tmp_name']);
         $rows = $data->sheets[0]['numRows'];
         $cols = $data->sheets[0]['numCols'];
         $exam_part_array = array();
         $break = false;
         for ($i = 1; $i < $cols; $i++) {
             if ($data->sheets[0]['cells'][0][$i] == '' || is_numeric($data->sheets[0]['cells'][0][$i])) {
                 showMessage('某大题的名字是空的或是数字', 'warning');
                 $break = true;
                 break;
             }
             $exam_part_data_array[] = array('exam_paper' => $currentExam['exam_paper'], 'name' => $data->sheets[0]['cells'][0][$i]);
         }
         if ($break) {
             break;
         }
         for ($i = 1; $i < $rows; $i++) {
             for ($j = 1; $j < $cols; $j++) {
                 $cell = isset($data->sheets[0]['cells'][$i][$j]) ? $data->sheets[0]['cells'][$i][$j] : '';
                 if (!(is_numeric($cell) || $cell == '') || $cell < 0) {
                     showMessage('第' . ($i + 1) . '行 第' . ($j + 1) . '列的数据' . $cell . '中包含错误字符,注意只能是数字或留空(缺考)', 'warning');
                     $break = true;
                     break;
                 }
             }
             if ($break) {
                 break;
             }
             if (array_sum(array_slice($data->sheets[0]['cells'][$i], 1)) > 150) {
                 showMessage('第' . $i . '行的小分和超过了150分!注意不用填写总分', 'warning');
                 $break = true;
                 break;
             }
         }
         if ($break) {
             break;
         }
         if ($rows - 1 < $currentExam['students']) {
             //showMessage('本张试卷有'.$currentExam['students'].'人参考,上传的分数为'.($rows-1).'条,请检核数据重新上传','warning');break;
         }
         foreach ($exam_part_data_array as $exam_part_data) {
             //插入大题
             $this->db->insert('exam_part', $exam_part_data);
             $exam_part_array[] = $this->db->insert_id();
         }
         //创建一张临时表
         $q_create_temp_table = "CREATE TEMPORARY TABLE `t` (`id` INT NOT NULL AUTO_INCREMENT, `num` CHAR( 6 ) NOT NULL,";
         foreach ($exam_part_array as $exam_part) {
             $q_create_temp_table .= "`" . $exam_part . "` DECIMAL( 10, 1 ) NULL,";
         }
         $q_create_temp_table .= " PRIMARY KEY (`id`) ,UNIQUE (`num`))";
         $this->db->query($q_create_temp_table);
         //excel表格上传到临时表
         $q_insert_t_score = 'INSERT INTO t (num,`' . implode('`,`', $exam_part_array) . '`) VALUES';
         for ($i = 1; $i < $rows; $i++) {
             $q_insert_t_score .= "('" . $data->sheets[0]['cells'][$i][0] . "'";
             for ($j = 1; $j < $cols; $j++) {
                 $cell = isset($data->sheets[0]['cells'][$i][$j]) ? $data->sheets[0]['cells'][$i][$j] : '';
                 $q_insert_t_score .= "," . ($cell == '' ? 'NULL' : "'" . $cell . "'") . "";
             }
             $q_insert_t_score .= ')';
             if ($i != $rows - 1) {
                 $q_insert_t_score .= ',';
             }
         }
         if (!$this->db->query($q_insert_t_score)) {
             showMessage('上传错误,可能有重复学号或者错误的学号', 'warning');
             break;
         }
         $q_search_illegal_student = "\n\t\t\t\tSELECT id,num FROM t WHERE num NOT IN\n\t\t\t\t(\n\t\t\t\t\tSELECT view_student.num \n\t\t\t\t\tFROM exam_student INNER JOIN view_student ON view_student.id=exam_student.student\n\t\t\t\t\tWHERE exam_student.exam='" . $currentExam['exam'] . "'" . (isset($currentExam['extra_course']) ? " AND exam_student.extra_course='" . $currentExam['extra_course'] . "'" : '') . "\n\t\t\t\t)\n\t\t\t\tLIMIT 1\n\t\t\t";
//.........这里部分代码省略.........
开发者ID:flyingfish2013,项目名称:Syssh,代码行数:101,代码来源:score.php

示例10: SaveOperation

function SaveOperation()
{
    $obj = new NTC_operations();
    PdoDataAccess::FillObjectByArray($obj, $_POST);
    $obj->GroupLetter = isset($_POST["GroupLetter"]) ? "YES" : "NO";
    $pdo = PdoDataAccess::getPdoObject();
    $pdo->beginTransaction();
    if (empty($obj->OperationID)) {
        $obj->OperationDate = PDONOW;
        $result = $obj->Add($pdo);
    } else {
        $result = $obj->Edit($pdo);
    }
    require_once "phpExcelReader.php";
    $data = new Spreadsheet_Excel_Reader();
    $data->setOutputEncoding('utf-8');
    $data->setRowColOffset(0);
    $data->read($_FILES["PersonFile"]["tmp_name"]);
    for ($i = 0; $i < $data->sheets[0]['numRows']; $i++) {
        if (!empty($data->sheets[0]['cells'][$i][0])) {
            $PersonID = $data->sheets[0]['cells'][$i][0];
            $dt = PdoDataAccess::runquery("select PersonID from BSC_persons where PersonID=?", array($PersonID));
            if (count($dt) > 0) {
                $PersonObj = new NTC_persons();
                $PersonObj->OperationID = $obj->OperationID;
                $PersonObj->PersonID = $PersonID;
                for ($j = 1; $j < count($data->sheets[0]['cells'][$i]); $j++) {
                    eval("\$PersonObj->col{$j} = '" . $data->sheets[0]['cells'][$i][$j] . "';");
                }
                $PersonObj->Add($pdo);
            }
        }
    }
    $dt = NTC_persons::Get(" AND OperationID=?", array($obj->OperationID), $pdo);
    if ($dt->rowCount() == 0) {
        $pdo->rollBack();
        echo Response::createObjectiveResponse(false, "در فایل ارسالی هیچ فرد معتبری یافت نشد");
        die;
    }
    $dt = $dt->fetchAll();
    //----------- create letter -------------
    if ($obj->SendType == "LETTER" && $obj->GroupLetter == "YES") {
        $LetterObj = new OFC_letters();
        $LetterObj->LetterType = "INNER";
        $LetterObj->LetterTitle = $obj->title;
        $LetterObj->LetterDate = PDONOW;
        $LetterObj->RegDate = PDONOW;
        $LetterObj->PersonID = $_SESSION["USER"]["PersonID"];
        $LetterObj->context = $obj->context;
        if (!$LetterObj->AddLetter($pdo)) {
            ExceptionHandler::PushException("خطا در ثبت  نامه");
        }
    }
    //---------------------------------------
    foreach ($dt as $row) {
        $context = $obj->context;
        for ($i = 1; $i < 10; $i++) {
            $context = preg_replace("/\\[col" . $i . "\\]/", $row["col" . $i], $context);
        }
        switch ($obj->SendType) {
            case "SMS":
                break;
                //------------------------------------------------------------------
            //------------------------------------------------------------------
            case "EMAIL":
                $email = $row["email"];
                if ($email == "") {
                    ExceptionHandler::PushException("فاقد ایمیل");
                    continue;
                }
                $result = SendEmail($email, $obj->title, $context);
                if (!$result) {
                    ExceptionHandler::PushException("خطا در ارسال ایمیل");
                }
                break;
                //------------------------------------------------------------------
            //------------------------------------------------------------------
            case "LETTER":
                if ($obj->GroupLetter == "NO") {
                    $LetterObj = new OFC_letters();
                    $LetterObj->LetterType = "INNER";
                    $LetterObj->LetterTitle = $obj->title;
                    $LetterObj->LetterDate = PDONOW;
                    $LetterObj->RegDate = PDONOW;
                    $LetterObj->PersonID = $_SESSION["USER"]["PersonID"];
                    $LetterObj->context = $context;
                    $LetterObj->AddLetter($pdo);
                    $SendObj = new OFC_send();
                    $SendObj->LetterID = $LetterObj->LetterID;
                    $SendObj->FromPersonID = $LetterObj->PersonID;
                    $SendObj->ToPersonID = $row["PersonID"];
                    $SendObj->SendDate = PDONOW;
                    $SendObj->SendType = 1;
                    if (!$SendObj->AddSend($pdo)) {
                        ExceptionHandler::PushException("خطا در ثبت  نامه");
                    }
                } else {
                    $Cobj = new OFC_LetterCustomers();
                    $Cobj->LetterID = $LetterObj->LetterID;
                    $Cobj->PersonID = $row["PersonID"];
//.........这里部分代码省略.........
开发者ID:jafarkhani,项目名称:rtfund,代码行数:101,代码来源:operation.data.php


注:本文中的Spreadsheet_Excel_Reader::setRowColOffset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。