Skip to content

Instantly share code, notes, and snippets.

{"id":"367603010","currency":"EGP","driver_id":"D934245","client_id":"439695","date":"06/03/2023","execution_date":"06/03/2023","client_ref":"","cutoff_date":"07/03/2023","jobcode_status":"Completed","location":"Heavy","vertical":"Domestic","class":"","shipper_id":"","gate_in":"NO GATE","gate_out":"NO GATE","destination":"برقاش","start_date":"06/03/2023","job_group_on_bill":"449237","booking_number":"","has_genset":"No","genset_cost_price":"","genset_sales_price":"","has_triangulation":"No","triangulation_cost_price":0,"triangulation_sales_price":0,"has_delay":"No","delay_cost_price":0,"delay_sales_price":0,"has_xray_delay":"No","xray_delay_cost_price":"","xray_delay_sales_price":"","contractor_id":"","bill_of_lading":"44490","truck_number":"750509","truck_license_number":"6975 م س ب","tail_code":"879738","tail_license_number":"9745 م د ر","cargo":"Trailer","first_container":"","second_container":"","load_weight":"9000","driver_cost":2640,"customer_price":3000,"accessories
/**
* @NApiVersion 2.1
* @NScriptType Restlet
*/
define([
"N/record",
"N/runtime",
"N/search",
"/SuiteApps/com.netsuite.base/api",
"/SuiteApps/com.netsuite.base/utils",
{
"code": 200,
"invoices": [
{
"document_type": "I",
"number": "...",
"purchase_order_reference": "",
"purchase_order_description": "",
"sales_order_reference": "",
"sales_order_description": "",
@marwan-nwh
marwan-nwh / clean_code.md
Created September 27, 2022 10:40 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

Installation

  • Select a Role to use, and add SuiteApp Deployment permission to it
  • Enable SuiteCloud Development Framework
  • Install SuiteCloud Development Integration bundle
  • Using the auto-generated SuiteCloud Development Integration, create Access Token
  • Install SDF, and cd into the project directory
  • Setup account using suitecloud account:setup -i
  • Preview deployment using suitecloud project:deploy --dryrun
  • Deploy using suitecloud project:deploy --applyinstallprefs
let netpaymentInWords = i18n
.spellOut({ number: Number(netpayment), locale: "en" })
.toLowerCase();
if (netpaymentInWords.indexOf("point") > -1) {
netpaymentInWords =
netpaymentInWords.replace("point", "saudi riyal point") +
" halala only.";
} else {
netpaymentInWords += " saudi riyal only.";
/**
* @NApiVersion 2.1
* @NScriptType ScheduledScript
*/
define(["N/format"], function (format) {
function formatDate(date) {
var formatedDate = format.format({
value: new Date(date),
type: format.Type.DATE,
});
/**
*@NApiVersion 2.1
*@NScriptType ScheduledScript
*/
define(["N/record", "N/search"], function (record, search) {
function execute(context) {
try {
let results = search.load({
id: "customsearch_test_ae_shipment",
}).run().getRange(0, 100);
/**
*@NApiVersion 2.x
*@NScriptType ClientScript
*/
define(["N/error"], function (error) {
function round(num) {
return Math.round((num + Number.EPSILON) * 100) / 100;
}
function fieldChanged(context) {
const Oauth1Helper = require("./helper");
const axios = require("axios");
const authHeader = Oauth1Helper.getAuthHeaderForRequest(request);
await axios.post(URL, JSONObj, {
headers: {
Authorization: authHeader.Authorization,
"Content-Type": "application/json",
},
});