# crystalpy-barno
Python Integration with Crystal Report for Dynamic Output
=====================================================
## Features
* Connect Crystal Report with Python for dynamic output
## Installation
To install this project, run the following command:
```bash
pip install crystalpy-barno
```
## Usage
### Example Code
```python
import os
from datetime import datetime
from crystalpy_barno.helpers.report_loader_helper import CrystalReportsLoader
from crystalpy_barno.config.database_config import DatabaseConfig
from crystalpy_barno.entry_point import generate_report
# Set database connection details externally
DatabaseConnectionHelper.set_connection_details(
server_name="SERVER_NAME",
database_name="DB_NAME",
user_id="USER",
password="PASS"
)
voucher_no = "VOUCHER_NO"
pdf_dir = os.path.join(cwd, 'pdf')
pdf_dir_sales = os.path.join(pdf_dir, 'sales')
pdf_filepath_sale = os.path.join(pdf_dir_sales, f"{voucher_no}.pdf")
# Generate a report
generate_report(
report_type="sale_memo",
filename='rpt/Sale_Memo_IncludeMaking.rpt',
output_path=pdf_filepath_sale,
parameters={
"@pvSourcerecNo": '2425SOEBAR02135',
"@pvVoucherNo": "2425SOPBAR00778",
"@pvLeCode": "NJ",
"@pvUserCode": "NIM",
"@pvReportID": 1,
"@pvIncludingMaking": "1",
},
formulas={
"EmployeeName": "John Doe",
"ReportCaption": "Sales Report"
},
sp_name="spSale_Memo",
file_type="pdf"
)
```
## Report Generation
This code generates a sales memo report using the SaleMemo function from the SaleSnippet module. The report is generated based on the provided parameters and saved as a PDF file in the specified output path.
## Database Connection
The database connection details are set externally using the DatabaseConnectionHelper class. You need to replace the placeholders with your actual database connection details.
## Report Templates
The report template used in this example is Sale_Memo_IncludeMaking.rpt. You can modify this template or use a different one to suit your reporting needs.
## Output Directory
The output directory for the generated report is specified using the pdf_dir variable. You can modify this to change the output directory.
## Contributing
Contributions are welcome! Please submit a pull request with your changes and a brief description of what you've added or fixed.
## License
This project is licensed under the MIT License.
Raw data
{
"_id": null,
"home_page": "https://github.com/barno1994/crystalpy_barno",
"name": "crystalpy-barno",
"maintainer": "barno.baptu",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "barno.baptu@gmail.com",
"keywords": "crystal report, python integration with crystal report",
"author": "barno1994",
"author_email": "barno.baptu@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ba/81/9202804d13823ee1d3e091d1c264785cfdb737f15976620ad41e04eee220/crystalpy_barno-1.1.25.tar.gz",
"platform": null,
"description": "# crystalpy-barno\n\nPython Integration with Crystal Report for Dynamic Output\n=====================================================\n\n## Features\n\n* Connect Crystal Report with Python for dynamic output\n\n## Installation\n\nTo install this project, run the following command:\n```bash\npip install crystalpy-barno\n\n```\n\n## Usage\n\n### Example Code\n```python\nimport os\nfrom datetime import datetime\n\nfrom crystalpy_barno.helpers.report_loader_helper import CrystalReportsLoader\nfrom crystalpy_barno.config.database_config import DatabaseConfig\nfrom crystalpy_barno.entry_point import generate_report\n\n# Set database connection details externally\nDatabaseConnectionHelper.set_connection_details(\n server_name=\"SERVER_NAME\",\n database_name=\"DB_NAME\",\n user_id=\"USER\",\n password=\"PASS\"\n)\n\nvoucher_no = \"VOUCHER_NO\"\npdf_dir = os.path.join(cwd, 'pdf')\npdf_dir_sales = os.path.join(pdf_dir, 'sales')\npdf_filepath_sale = os.path.join(pdf_dir_sales, f\"{voucher_no}.pdf\")\n\n# Generate a report\ngenerate_report(\n report_type=\"sale_memo\",\n filename='rpt/Sale_Memo_IncludeMaking.rpt',\n output_path=pdf_filepath_sale,\n parameters={\n \"@pvSourcerecNo\": '2425SOEBAR02135',\n \"@pvVoucherNo\": \"2425SOPBAR00778\",\n \"@pvLeCode\": \"NJ\",\n \"@pvUserCode\": \"NIM\",\n \"@pvReportID\": 1,\n \"@pvIncludingMaking\": \"1\",\n },\n formulas={\n \"EmployeeName\": \"John Doe\",\n \"ReportCaption\": \"Sales Report\"\n },\n sp_name=\"spSale_Memo\",\n file_type=\"pdf\"\n)\n```\n\n## Report Generation\nThis code generates a sales memo report using the SaleMemo function from the SaleSnippet module. The report is generated based on the provided parameters and saved as a PDF file in the specified output path.\n\n## Database Connection\nThe database connection details are set externally using the DatabaseConnectionHelper class. You need to replace the placeholders with your actual database connection details.\n\n## Report Templates\nThe report template used in this example is Sale_Memo_IncludeMaking.rpt. You can modify this template or use a different one to suit your reporting needs.\n\n## Output Directory\nThe output directory for the generated report is specified using the pdf_dir variable. You can modify this to change the output directory.\n\n## Contributing\nContributions are welcome! Please submit a pull request with your changes and a brief description of what you've added or fixed.\n\n## License\nThis project is licensed under the MIT License.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python integration with Crystal Reports",
"version": "1.1.25",
"project_urls": {
"Homepage": "https://github.com/barno1994/crystalpy_barno",
"Issues": "https://github.com/barno1994/crystalpy_barno/issues"
},
"split_keywords": [
"crystal report",
" python integration with crystal report"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "1ab6498c72a41550362da942488456a7930191f3866e13272215b2ff47a2b508",
"md5": "8186f8712b894179e3e432b14e8fe4ff",
"sha256": "2724bf38e524ab64ea224d5794442c9a1dabff9b1b3406257f9bcfd7fbd360a8"
},
"downloads": -1,
"filename": "crystalpy_barno-1.1.25-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8186f8712b894179e3e432b14e8fe4ff",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 460680,
"upload_time": "2025-02-07T10:34:39",
"upload_time_iso_8601": "2025-02-07T10:34:39.107045Z",
"url": "https://files.pythonhosted.org/packages/1a/b6/498c72a41550362da942488456a7930191f3866e13272215b2ff47a2b508/crystalpy_barno-1.1.25-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "ba819202804d13823ee1d3e091d1c264785cfdb737f15976620ad41e04eee220",
"md5": "14988df11e2e6af47430c17cdb335a8e",
"sha256": "c23c44806eb0da3af472b8b9111b68acac94a4c34bde4877aa136fd49218e306"
},
"downloads": -1,
"filename": "crystalpy_barno-1.1.25.tar.gz",
"has_sig": false,
"md5_digest": "14988df11e2e6af47430c17cdb335a8e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 460306,
"upload_time": "2025-02-07T10:34:40",
"upload_time_iso_8601": "2025-02-07T10:34:40.537104Z",
"url": "https://files.pythonhosted.org/packages/ba/81/9202804d13823ee1d3e091d1c264785cfdb737f15976620ad41e04eee220/crystalpy_barno-1.1.25.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-07 10:34:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "barno1994",
"github_project": "crystalpy_barno",
"github_not_found": true,
"lcname": "crystalpy-barno"
}