定制 rolecode/php-minimax 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rolecode/php-minimax

最新稳定版本:0.1.4

Composer 安装命令:

composer require rolecode/php-minimax

包简介

README 文档

README

Library is still in development and is limited with features. More features will be added in the future.

Summary

  1. Installation
  2. Examples of use
  3. Licence

Installation

You can install library with composer:

composer require rolecode/php-minimax

Examples of use

Basic setup

    // Create minimax instance.
    $minimax = new MinimaxClient( "YOUR_MINIMAX_CLIENT_ID", "YOUR_MINIMAX_CLIENT_PASSWORD", "YOUR_MINIMAX_USER_NAME", "YOUR_MINIMAX_USER_PASSWORD" );

    // Retrieve organisations. 
    $organisations =  $minimax->organisations->all();

    // Organisation must be set before performing other calls. 
    $minimax->setOrganisationId( "YOUR_ORGANISATION_ID" );

Document numbering

    $documentNumberingsAll = $minimax->documentNumberings->all();
    $documentNumberingId = $documentNumberings[0]->DocumentNumberingId;
    $documentNumberingRetrievedById = $minimax->documentNumberings->retrieve( $documentNumberingId );

Employees

    $allEmployees = $minimax->employees->all();
    $employeeId = $employees[0]->EmployeeId;
    $employeeRetrievedById = $minimax->employees->retrieve( $employeeId );

Report templates

    // List of request params: https://moj.minimax.si/SI/API/Help/Api/GET-api-orgs-organisationId-report-templates
    $reportTemplatesAll = $minimax->reportTemplates->all( ['SearchString' => 'IR'] );
    $reportTemplateId = $reportTemplates[0]->ReportTemplateId;
    $reportTemplateRetrievedById = $minimax->reportTemplates->retrieve( $reportTemplateId );

Employees

    $employeesAll = $minimax->employees->all();
    $employeeId = $employees[0]->EmployeeId;
    $employeeRetrievedById = $minimax->employees->retrieve( $employeeId );

Items

    $items = $minimax->items->all( ['SearchString' => '111'] );
    $itemRetrievedById = $minimax->items->retrieveById( "INSERT_ID" );
    $itemRetrievedByCode = $minimax->items->retrieveByCode( "INSERT_CODE" );
    
    // Prepare item and create it.
    $item = new Item();
    $item->Name = "Example item.";
    $item->Code = 1;
    $item->ItemType = ItemType::GOOD;
    $item->VatRate = new mMApiFkField( 36 );
    $item->Currency = new mMApiFkField( 7 );
    $createdItem = $minimax->items->create( $item );
    
    // Update item.
    $item = $minimax->items->retrieveById( "INSERT_ID" );
    $item->Name = "New item name";
    $updatedItem = $minimax->items->update( $item );

    // Delete item.
    $minimax->items->delete( "ID" );

Vatrates

    $vatRates = $minimax->vatRates->all();
    $vatRateStandard = $minimax->vatRates->retrieveByCode( VatRateCode::STANDARD );

Issued invoice

    $invoicesAll = $minimax->issuedInvoices->all();
    $invoiceRetrievedById = $minimax->issuedInvoices->retrieveById( "INSERT_ID" );

    // Create invoice.
    // First prepare invoice rows.
    $invoiceRows = [];
    $row = new IssuedInvoiceRow();
    $row->RowNumber = 1;
    $row->Item = new mMApiFkField( "INSERT_ITEM_ID" );
    $row->Quantity = 1;
    $row->Price = 1;
    $row->PriceWithVAT = 1.22;
    $row->Value = $row->PriceWithVAT;
    $row->VatRate = new mMApiFkField( $vatRateStandard->VatRateId );
    $row->VATPercent = $vatRateStandard->Percent;
    $invoiceRows[] = $row;


    // Prepare invoice payments.
    $invoicePayments = [];
    $row = new IssuedInvoicePaymentMethod();
    $row->PaymentMethod = new mMApiFkField( $paymentMethod->PaymentMethodId );
    $row->AlreadyPaid = "D";
    $invoicePayments[] = $row;

    // Prepare invoice object.
    $invoice = new IssuedInvoice();
    $invoice->InvoiceType = "R";
    $invoice->Customer = new mMApiFkField( $customer->CustomerId );
    $invoice->DateIssued = date( Date::DATE_FORMAT );
    $invoice->DateTransactionFrom = $invoice->DateIssued;
    $invoice->DateTransaction = $invoice->DateIssued;
    $invoice->DateDue = date( Date::DATE_FORMAT )( Date::DATE_FORMAT );
    $invoice->IssuedInvoiceRows = $invoiceRows;
    $invoice->IssuedInvoicePaymentMethods = $invoicePayments;

    // Create invoice.
    $invoice = $minimax->issuedInvoices->create( $invoice );

    // Issue and generate pdf for invoice.
    $invoice = $minimax->issuedInvoices->performAction( $invoice->IssuedInvoiceId, $invoice->RowVersion, "issueAndGeneratepdf" );

    // Retrieve invoice document pdf.
    $documentId = $invoice->Document->ID;
    $documentAttachmentId = $invoice->InvoiceAttachment->ID;
    $documentAttachment = $minimax->documentAttachments->retrieve( $documentId, $documentAttachmentId );

   // Save file to disk.
    file_put_contents($documentAttachment->FileName, $documentAttachment->getDecodedAttachmentData());

Licence

Library is made available under the MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 13
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-11-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固