clieop.php
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 636 行 · 第 1/2 页
PHP
636 行
<?php/* vim: set expandtab tabstop=4 shiftwidth=4: */// +----------------------------------------------------------------------+// | PHP Version 4 |// +----------------------------------------------------------------------+// | Copyright (c) 1997-2003 The PHP Group |// +----------------------------------------------------------------------+// | This source file is subject to version 2.0 of the PHP license, |// | that is bundled with this package in the file LICENSE, and is |// | available at through the world-wide-web at |// | http://www.php.net/license/2_02.txt. |// | If you did not receive a copy of the PHP license and are unable to |// | obtain it through the world-wide-web, please send a note to |// | license@php.net so we can mail you a copy immediately. |// +----------------------------------------------------------------------+// | Authors: Dave Mertens <dmertens@zyprexia.com> |// +----------------------------------------------------------------------+//// $Id: clieop.php,v 1.14 2003/01/28 14:29:52 zyprexia Exp $/* Please note that public function names are partly in Dutch. This is because also the clieop data strings has a dutch names. (batchvoorloopinfo, transactieinfo, etc). *//*** Main clieop class** @version $Revision: 1.14 $* @access public* @author Dave Mertens <dmertens@zyprexia.com>* @package Payment_Clieop*/class ClieopPayment extends clieop_baseobject{ /** * @var string * @access private */ var $_SenderIdent; /** * @var string * @access private */ var $_FileIdent; /** * @var string * @access private */ var $_TransactionType; /** * @var string * @access private */ var $_ClieopText; /** * @var string * @access private */ var $_PrincipalAccountNumber; /** * @var string * @access private */ var $_PrincipalName; /** * @var integer * @access private */ var $_BatchNumber; /** * @var integer * @access private */ var $_TransactionCount; /** * @var integer * @access private */ var $_TotalAmount; /** * @var string * @access private */ var $_AccountChecksum; /** * @var string * @access private */ var $_Description; /** * @var date (in DDMMYY format) * @access private */ var $_ProcessDate; /** * @var boolean * @access private */ var $_Test; /** * @var string * @access private */ var $_TransactionText; /** * Constructor for class * @return void * @access public */ function clieopPayment() { //init vars $this->_ProcessDate = "000000"; //process ASAP $this->_BatchNumber = 1; $this->_Test = "T"; return 1; } /** * Adds a payment record to the clieop file * @param object paymentObject - Instance of transactionPayment * @access public * @return void */ function addPayment($paymentObject) { //Only one type of transaction is allowed in a clieop if ($this->_TransactionType == $paymentObject->getPaymentType()) { //transactieinfo (0100) $text = $this->writeTransactieInfo($paymentObject->getTransactionType(), $paymentObject->getAmount(), $paymentObject->getAccountNumberSource(), $paymentObject->getAccountNumberDest()); // Debtor name ans city if (strtoupper($this->_TransactionType) == "DEBTOR") { //name of debtor (0110) $text .= $this->writeNaambetalerInfo($paymentObject->getName()); //city of debtor (0113) $text .= $this->writeWoonplaatsbetalerInfo($paymentObject->getCity()); } //betalings kenmerk (0150) $text .= $this->writeBetalingskenmerkInfo($paymentObject->getInvoiceReference()); //maximum 4 description lines (0160) $descArray = $paymentObject->getDescription(); while(list($id,$desc) = each($descArray)) { $text .= $this->writeOmschrijvingInfo($desc); } //routine splits here into creditor and debtor if (strtoupper($this->_TransactionType) == "CREDITOR") { //name of creditor (0170) $text .= $this->writeNaambegunstigdeInfo($paymentObject->getName()); //city of creditor (0173) $text .= $this->writeWoonplaatsbegunstigdeInfo($paymentObject->getCity()); } //do some calculations $this->_NumberOfTransactions++; //accoutnumber checksum $this->_AccountChecksum += (int)$paymentObject->getAccountNumberSource() + (int)$paymentObject->getAccountNumberDest(); $this->_TotalAmount += $paymentObject->getAmount(); } $this->_TransactionText .= $text; } /** * Writes complete clieop file * @access public * @return string */ function writeClieop() { $text = $this->writeBestandsvoorloopInfo($this->_SenderIdent, $this->_BatchNumber); $text .= $this->writeBatchvoorloopInfo($this->_PrincipalAccountNumber, $this->_BatchNumber); $text .= $this->writeVasteomschrijvingInfo($this->_FixedDescription); $text .= $this->writeOpdrachtgeverInfo($this->_ProcessDate, $this->_PrincipalName); $text .= $this->_TransactionText; $text .= $this->writeBatchsluitInfo(); $text .= $this->writeBestandssluitInfo(); //return clieop file return $text; } /** * property BatchNumber * @param integer Value - Number of batches send to day (including this one) * @return string * @access public */ function getBatchNumber() { return $this->_BatchNumber; } function setBatchNumber($Value) { $this->_BatchNumber = $Value; } /** * property FixedDescription * @param string Value - Description which will be added to each transaction payment * @return string * @access public */ function getFixedDescription() { return $this->_FixedDescription; } function setFixedDescription($Value) { $this->_FixedDescription = $Value; } /** * property SenderIdentification * @param string Value - Identification of sender, free of choice * @return string * @access public */ function getSenderIdentification() { return $this->_SenderIdent; } function setSenderIdentification($Value) { $this->_SenderIdent = $Value; } /** * property PrincipalName * @param string Value - Name of principal * @return string * @access public */ function getPrincipalName() { return $this->_PrincipalName; } function setPrincipalName($Value) { $this->_PrincipalName = $Value; } /** * property PrincipalAccountNumber * @param string Value - Account number of principal * @return string * @access public */ function getPrincipalAccountNumber() { return $this->_PrincipalAccountNumber; } function setPrincipalAccountNumber($Value) { $this->_PrincipalAccountNumber = $Value; } /** * property TransactionType * @param string Value - transaction type * @return string * @access public */ function getTransactionType() { return $this->_TransactionType; } function setTransactionType($Value) { switch($Value) { case "00": //BETALING $this->_TransactionType = "CREDITOR"; $this->_TransactionCode = "00"; break; case "10": //INCASSO $this->_TransactionType = "DEBTOR"; $this->_TransactionCode = "10"; break; } } /** * property Test * @param boolean Value - true = test clieop, false = production clieop * @return string * @access public */ function getTest() { return $this->_Test; } function setTest($Value)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?