PHPackages                             retail-cosmos/ioi-city-mall-sales-file - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. retail-cosmos/ioi-city-mall-sales-file

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

retail-cosmos/ioi-city-mall-sales-file
======================================

The IOI City Mall Sales File Generator is a Laravel package that simplifies the creation of daily sales data files for IOI City Mall stores. It seamlessly integrates into Laravel projects, streamlining data generation for retail management.

v1.0.4(1y ago)232.1k↑11.2%[3 PRs](https://github.com/Retail-Cosmos/ioi-city-mall-sales-file/pulls)MITPHPPHP ^8.2CI passing

Since Nov 29Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/Retail-Cosmos/ioi-city-mall-sales-file)[ Packagist](https://packagist.org/packages/retail-cosmos/ioi-city-mall-sales-file)[ Docs](https://github.com/retail-cosmos/ioi-city-mall-sales-file)[ RSS](/packages/retail-cosmos-ioi-city-mall-sales-file/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (15)Versions (9)Used By (0)

The IOI City Mall Sales File Generator
======================================

[](#the-ioi-city-mall-sales-file-generator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d4a2742748c4187442aa039e701fd4a93704c42025b908cebbdde5de4100155b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72657461696c2d636f736d6f732f696f692d636974792d6d616c6c2d73616c65732d66696c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/retail-cosmos/ioi-city-mall-sales-file)[![GitHub Tests Action Status](https://camo.githubusercontent.com/8a945538452d838810346008cec18aa567ba4068f06772a386487067857f3f41/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72657461696c2d636f736d6f732f696f692d636974792d6d616c6c2d73616c65732d66696c652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/retail-cosmos/ioi-city-mall-sales-file/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/f4f39d8ff8828231bf0b5bd00f0ddd420e4344f553f46f1e05cbb25fc511b7a7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72657461696c2d636f736d6f732f696f692d636974792d6d616c6c2d73616c65732d66696c652f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/retail-cosmos/ioi-city-mall-sales-file/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/abe6a2490de86df54009789985356bd7c3a753448482d9b190cd3ef6ea6502bf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72657461696c2d636f736d6f732f696f692d636974792d6d616c6c2d73616c65732d66696c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/retail-cosmos/ioi-city-mall-sales-file)

The IOI City Mall Sales File Generator is a Laravel package that simplifies the creation of daily sales data files for IOI City Mall stores. It seamlessly integrates into Laravel projects, streamlining data generation for retail management.

Installation
------------

[](#installation)

1. Install the package via composer:

```
composer require retail-cosmos/ioi-city-mall-sales-file
```

2. Publish the config file with:

```
php artisan vendor:publish --tag="ioi-city-mall-sales-file-config"
```

3. Please set values for all the options in the config file.

Usage
-----

[](#usage)

The functionality is divided into two parts. The first part is the [File Generation](#file-generation) and the second part is the [File Upload (SFTP)](#file-upload-sftp).

### File Generation

[](#file-generation)

Please follow these steps for the file generation.

1. Add a [scheduler](https://laravel.com/docs/10.x/scheduling) in your Laravel project to call the command `generate:ioi-city-mall-sales-files` daily at midnight. It generates the sales file for the previous day for each store as returned from the application.

```
$schedule->command('generate:ioi-city-mall-sales-files')->daily();
```

Tip

If you wish to generate a specific sales file, you may pass the following options to the command:

- `date` - Date in the YYYY-MM-DD format to generate a sales file for a specific date.
- `store_identifier` - To generate a sales file for a specific store only.

2. Create a new class `IOICityMallSalesDataService` in the `App/Services` namespace and add a `storesList()` method in it. It should return the collection of stores. The keys need to be:
    - `store_identifier` (String)
    - `machine_id` (String. Machine ID as received from the IOI City Mall)
    - `sst_registered` (Boolean)

When you pass a `store_identifier` as an option to the sales file generation command, the package passes it as a parameter to the `storesList()` method.

Click here to see the example code for the storesList() method```
public function storesList(string $storeIdentifier = null): Collection
{
    return collect([
        [
            'store_identifier' => 'my_store_46592',
            'machine_id' => 48623791,
            'sst_registered' => false,
        ],
        [
            'store_identifier' => 'my_store_97314',
            'machine_id' => 37196428,
            'sst_registered' => true,
        ],
    ]);
}
```

Tip

If you return a blank collection, the command does not generate any sales file and just logs a message.

3. Add a `salesData()` method in the `IOICityMallSalesDataService` class. The package will call this method to get the sales data. The method receives the following parameters:
    - `store_identifier` (string) - as returned from the `storesList()` method or passed to the sales file generation command as an option.
    - `date` (string) - YYYY-MM-DD format

This is the main part of the implementation. You need to add code for this method in a way that it fetches the sales data for the specified store for the specified date and returns a collection of sales. The keys need to be:

```
    - 'happened_at' (Date and time of the sale)
    - 'net_amount' (Total amount of the sale after discount and before SST)
    - 'discount' (Total discount amount of the sale. Item-wise division is not needed)
    - 'SST'
    - 'payments': (Amount of the payment type after discount and before SST)
        - 'cash'
        - 'tng'
        - 'visa'
        - 'mastercard'
        - 'amex'
        - 'voucher'
        - 'others'

```

Important

You can use `RetailCosmos\IoiCityMallSalesFile\Enums\PaymentType` enum for keys of the payments.

Click here to see the example code for the salesData() method```
public function salesData(string $storeIdentifier, string $date): Collection
{
    return collect([
        [
            'happened_at' => '2024-01-20 15:41:37',
            'net_amount' => 100,
            'discount' => 20,
            'SST' => 6,
            'payments' => [
                PaymentType::CASH->value => 50,
                PaymentType::TNG->value => 0,
                PaymentType::VISA->value => 30,
                PaymentType::MASTERCARD->value => 0,
                PaymentType::AMEX->value => 0,
                PaymentType::VOUCHER->value => 0,
                PaymentType::OTHERS->value => 20,
            ],
        ],
        [
            'happened_at' => '2024-01-20 16:18:09',
            'net_amount' => -50,
            'discount' => -5,
            'SST' => 0,
            'payments' => [
                PaymentType::CASH->value => -50,
                PaymentType::TNG->value => 0,
                PaymentType::VISA->value => 0,
                PaymentType::MASTERCARD->value => 0,
                PaymentType::AMEX->value => 0,
                PaymentType::VOUCHER->value => 0,
                PaymentType::OTHERS->value => 0,
            ],
        ],
    ]);
}
```

Tip

Take a note that you need to return sales for all the counters/registers of a store. The Mall expects the sales of all the counters to be combined in the file.

🚀 And that is it. The scheduler calls the command every day and the package generates a sales file and puts it into the the filesystem as per the config. Next, you may follow the steps for the [File Upload](#file-upload-sftp) part.

#### Disable File Generation

[](#disable-file-generation)

The package provides an .env variable `IOI_CITY_MALL_ENABLE_FILE_GENERATION` in case you wish to disable the file generation. If this .env variable is set to `false`, the file will not be generated even when the command is run.

#### Notes about generated sales files

[](#notes-about-generated-sales-files)

- The generated files are stored as per your config disk. There are two directories inside it: `pending_to_upload` and `uploaded` (These two directories are auto-generated if they don’t exist)
- The complete log of the generated files gets prepared and stored as per your log channel config. An email notification is sent as per your notifications config, if set. You may choose to receive only failure notifications also.

#### Note about Sale Returns

[](#note-about-sale-returns)

You may provide all the numbers in negative in case of refunds. As per the specifications, the refund amount should be deducted from the sales amount so it will automatically be taken care of during the grouping of records by the package.

#### Note about Batch IDs

[](#note-about-batch-ids)

`Batch ID` is managed by the package. As per the mall specifications, it needs to be a sequential number starting from 1 for the first file generated. You may set the `first_file_generation_date` in the config. The package counts the days from that date to calculate the Batch ID every time. If the date is not set in the config, an exception will be thrown.

### File Upload (SFTP)

[](#file-upload-sftp)

There is only one step to start the file uploads.

Add a [scheduler](https://laravel.com/docs/10.x/scheduling) in your Laravel project to call the command `upload:ioi-city-mall-sales-files` daily at 12:30 AM. It uploads all the files from the `pending_to_upload` directory via SFTP as per your config and moves those files to the `uploaded` directory.

```
$schedule->command('upload:ioi-city-mall-sales-files')->dailyAt('00:30');
```

The complete log of the uploaded files gets prepared and stored as per your log channel config. An email notification is sent as per your notifications config, if set. You may choose to receive only failure notifications also.

#### Disable File Upload (SFTP)

[](#disable-file-upload-sftp)

The package provides an .env variable `IOI_CITY_MALL_ENABLE_FILE_UPLOAD` in case you wish to disable the file upload. If this .env variable is set to `false`, the file will not be uploaded even when the command is run.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Harshvardhan Sharma](https://github.com/hvsharma63)
- [Gaurav Makhecha](https://github.com/gauravmak)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance64

Regular maintenance activity

Popularity31

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 54.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~63 days

Total

5

Last Release

649d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2628a8e3bd55b2ab1a2b4aaccb5a88d33854348c7a7d99e4f76f49c502692329?d=identicon)[gauravmak](/maintainers/gauravmak)

---

Top Contributors

[![hvsharma63](https://avatars.githubusercontent.com/u/19151036?v=4)](https://github.com/hvsharma63 "hvsharma63 (122 commits)")[![gauravmak](https://avatars.githubusercontent.com/u/11887260?v=4)](https://github.com/gauravmak "gauravmak (73 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (17 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (10 commits)")[![misusonu18](https://avatars.githubusercontent.com/u/52093984?v=4)](https://github.com/misusonu18 "misusonu18 (1 commits)")

---

Tags

laravelRetail-Cosmosioi-city-mall-sales-file

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/retail-cosmos-ioi-city-mall-sales-file/health.svg)

```
[![Health](https://phpackages.com/badges/retail-cosmos-ioi-city-mall-sales-file/health.svg)](https://phpackages.com/packages/retail-cosmos-ioi-city-mall-sales-file)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.8k28.9M627](/packages/spatie-laravel-data)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[marcelweidum/filament-expiration-notice

Customize the livewire expiration notice

9169.0k4](/packages/marcelweidum-filament-expiration-notice)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
