@rsc-labs/medusa-documents
Version:
Generate documents from Medusa
36 lines (35 loc) • 1.41 kB
JavaScript
;
/*
* Copyright 2024 RSC-Labs, https://rsoftcon.com/
*
* MIT License
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateInvoiceInformation = void 0;
const hr_1 = require("./hr");
const i18next_1 = require("i18next");
function generateInvoiceInformation(doc, y, invoice) {
doc
.fillColor("#444444")
.fontSize(20)
.text((0, i18next_1.t)("invoice", "Invoice"), 50, y + 40);
(0, hr_1.generateHr)(doc, y + 65);
const invoiceInformationTop = y + 80;
doc
.fontSize(10)
.text(`${(0, i18next_1.t)("invoice-number", "Invoice number")}:`, 50, invoiceInformationTop)
.font("Bold")
.text(invoice.display_number, 150, invoiceInformationTop)
.font("Regular")
.text(`${(0, i18next_1.t)("invoice-date", "Invoice date")}:`, 50, invoiceInformationTop + 15)
.text(invoice.created_at.toLocaleDateString(), 150, invoiceInformationTop + 15)
.moveDown();
return invoiceInformationTop + 15;
}
exports.generateInvoiceInformation = generateInvoiceInformation;