Snippets Collections
void Download_Medical_Certificate(string Recid_Medical_Certificate, string Medical_Certificate)
{
if(Medical_Certificate != "")
{
	path2 = Medical_Certificate.get(0).get("path");
	info "Path:" + path2;
	download_Medical_Certificate1 = invokeurl
	[
		url :path2
		type :GET
		connection:"developerforms"
	];
	info "DOWNLOAD: " + download_Medical_Certificate1;
	download_Medical_Certificate1.setParamName("file");
	info download_Medical_Certificate1;
	attach_file = invokeurl
	[
		url :"https://www.zohoapis.com/crm/v3/Medical_Certificates/" + Recid_Medical_Certificate + "/Attachments"
		type :POST
		files:download_Medical_Certificate1
		connection:"zoho_claim_shield_crm_connection"
	];
	info "Attaching files = " + attach_file;
}
}
void EFT_billing_update(int reqid)
{
get_doc_details = invokeurl
[
	url :"https://sign.zoho.com/api/v1/requests/" + reqid + ""
	type :GET
	connection:"zoho_sign"
];
//info get_doc_details;
resp = get_doc_details.get("requests");
//info resp;
document_ids = resp.get("document_ids");
//info document_ids;
document_fields = resp.get("document_fields");
//info document_fields;
for each  data in document_fields
{
	fields = data.get("fields");
	//info fields;
	for each  fields in fields
	{
		field_label = fields.get("field_label");
		//info field_label;
		if(field_label.contains("Company"))
		{
			//field_id = fields.get("field_id");
			//info field_id;
			Client_name = fields.get("field_value");
			info Client_name;
		}
	}
}
for each  rec in document_ids
{
	document_name = rec.get("document_name");
	//info document_name;
	if(document_name.contains("ClaimShield EFT Form"))
	{
		document_id = rec.get("document_id");
		//info document_id;
		downloadpdf = invokeurl
		[
			url :"https://sign.zoho.com/api/v1/requests/" + reqid + "/documents/" + document_id + "/pdf"
			type :GET
			connection:"zoho_sign"
		];
		//info downloadpdf;	
	}
}
//////done   "rajausman1313@gmail.com"
sendmail
[
	from :zoho.adminuserid
	to :"Billing@claimshieldpro.com"
	subject :"New Client Created - " + Client_name + ""
	message :"Please find attached EFT document for this client."
	Attachments :file:downloadpdf
]
}
//////////////Start Function///////////
Get_All_Employee_Attachments_Response = invokeurl
[
	url :"https://www.zohoapis.com/crm/v3/Leads/" + Emp_id + "/Attachments?fields=id,Owner,File_Name,Created_Time,Parent_Id"
	type :GET
	connection:"zoho_crm2"
];
//info response;
Records = Get_All_Employee_Attachments_Response.get("data");
//For each through all the Attachments returned by the above API call
for each  Record in Records
{
	File_Name = Record.get("File_Name");
	//info File_Name;
	if(File_Name.contains("Medical_Certificate"))
	{
		Attachment_ID = Record.get("id");
		Medical_Certificate_File_Name = Record.get("File_Name");
		//Below is a logging statement, do not delete
		info "Attachment_ID" + Attachment_ID;
	}
}
//Call the CRM API to get the actual attachment 
////I still am unsure if this is necessary. Since we are already getting all attachments, why do we need to specifically call another time to just get the 1 attachment? 
////Doesn't the first call (all Attachments) provide the data we need?
Get_Medical_Certificate_Response = invokeurl
[
	url :"https://www.zohoapis.com/crm/v6/Leads/" + Emp_id + "/Attachments/" + Attachment_ID + ""
	type :GET
	connection:"zoho_crm2"
];
//Below is a logging statement, do not delete
info "Get Medical Certificate Response: " + Get_Medical_Certificate_Response;
//
//Upload to Workdrive
////How is header being used?
header = Map();
header.put("Accept","application/vnd.api+json");
list_of_text = List();
list_of_text.add({"paramName":"filename","content":Medical_Certificate_File_Name,"stringPart":"true"});
list_of_text.add({"paramName":"parent_id","content":wd_folder_id,"stringPart":"true"});
list_of_text.add({"paramName":"override-name-exist","content":"true","stringPart":"true"});
list_of_text.add({"paramName":"content","content":Get_Medical_Certificate_Response,"stringPart":"false"});
Upload_Medical_Certificate_Response = invokeurl
[
	url :"https://www.zohoapis.com/workdrive/api/v1/upload"
	type :POST
	files:list_of_text
	connection:"zoho_wd"
];
//Below is a logging statement, do not delete
info "Upload Medical Certificate Response: " + Upload_Medical_Certificate_Response;
/////
response = invokeurl
[
	url :"https://www.zohoapis.com/crm/v5/Leads/" + rec_id + "/Attachments?fields=id,Owner,File_Name,Created_Time,Parent_Id"
	type :GET
	connection:"zoho_crm2"
];
//info response;
resp_data = response.get("data");
//info resp_data;
for each  data in resp_data
{
	File_Name = data.get("File_Name");
	//info File_Name;
	if(File_Name.contains("DRIVER APPLICATION"))
	{
		file_id1 = data.get("id");
		info file_id1;
		download_response = invokeurl
		[
			url :"https://www.zohoapis.com/crm/v5/Leads/" + rec_id + "/Attachments/" + file_id1 + ""
			type :GET
			connection:"zoho_crm2"
		];
		info download_response;
		download_response.setParamName("file");
		upload_response = invokeurl
		[
			url :"https://www.zohoapis.com/crm/v6/files"
			type :POST
			files:download_response
			connection:"zoho_crm2"
		];
		//info upload_response;
		resp_data = upload_response.get("data");
		for each  rec in resp_data
		{
			file_id = rec.get("details").get("id");
			//info file_id;
		}
	}
}
finallist = List();
frommp = Map();
frommp.put("email",from_email);
// frommp.put("email","zach.dugger@claimshieldpro.com");
mp = Map();
mp.put("from",frommp);
tomaplist = List();
tomap = Map();
tomap.put("email",manager_email_id);
tomaplist.add(tomap);
//…….Multiple Receiver………
tomap1 = Map();
tomap1.put("email",manager_email_id);
tomaplist.add(tomap1);
mp.put("to",tomaplist);
//..........Get Template Data............
TemplateID = "2314579000150955209";
templatemap = Map();
templatemap.put("id",TemplateID);
mp.put("template",templatemap);
mp.put("org_email",True);
//////
///////
attachmentlist = List();
attachmentmap = Map();
attachmentmap.put("id",file_id);
attachmentlist.add(attachmentmap);
mp.put("attachments",attachmentlist);
///////
finallist.add(mp);
finalmap = Map();
finalmap.put("data",finallist);
//info finallist;
///////
send_mail_resp = invokeurl
[
	url :"https://www.zohoapis.com/crm/v5/Leads/" + rec_id + "/actions/send_mail"
	type :POST
	parameters:finalmap.toString()
	connection:"zoho_crm2"
];
info send_mail_resp;
	queryMap = Map();
	queryMap.put("select_query", "select Account_Name, Company_Movement_Rate  from Accounts where Layout = '3251014000167943049' ");
	response = invokeurl
	[
	url :"https://www.zohoapis.com/crm/v3/coql"
	type :POST
	parameters: queryMap.toString()
	connection:"zoho_crm"
	];
	info response;
global with sharing class BK_FilterCollectionByField {
    global class FilterException extends Exception {}
    @InvocableMethod(label='Filter Collection By Field')
    global static List<Result> filterRecordsByField(List<Request> requests) {
        List<Result> results = new List<Result>();
        for(Request request : requests) {
            // Validate inputs
            if (request.allowEmptyCollection != true && (request.inputRecords == null || request.inputRecords.isEmpty())) {
                throw new FilterException('Input record collection is required but empty.');
            }
            if (request.filterValues == null || request.filterValues.isEmpty()) {
                throw new FilterException('Filter values are required but empty.');
            }
            if (String.isBlank(request.fieldAPIName)) {
                throw new FilterException('Field to filter by is required but empty.');
            }
            List<SObject> filteredRecords = new List<SObject>();
            if (request.allowEmptyCollection == true && (request.inputRecords == null || request.inputRecords.isEmpty())) {
                // Return empty result if allowed
                filteredRecords = new List<SObject>{};
            } else {
                // Prepare the set or list for filter values based on case sensitivity
                Set<String> filterValuesSet = new Set<String>();
                if(request.caseSensitive == true) {
                    filterValuesSet.addAll(request.filterValues);
                } else {
                    for(String value : request.filterValues) {
                        if(value != null) {
                            filterValuesSet.add(value.toLowerCase());
                        }
                    }
                }
                // Filter records
                for(SObject record : request.inputRecords) {
                    Object fieldValueObj = record.get(request.fieldAPIName);
                    if(fieldValueObj != null) {
                        String fieldValue = String.valueOf(fieldValueObj);
                        if(request.caseSensitive == true) {
                            if(filterValuesSet.contains(fieldValue)) {
                                filteredRecords.add(record);
                            }
                        } else {
                            if(filterValuesSet.contains(fieldValue.toLowerCase())) {
                                filteredRecords.add(record);
                            }
                        }
                    }
                }
            }
            Result result = new Result();
            result.filteredRecords = filteredRecords;
            results.add(result);
        }
        return results;
    }
    global class Request {
        @InvocableVariable(label='Input Records' description='Collection of records to filter' required=true)
        global List<SObject> inputRecords;
        @InvocableVariable(label='Filter Values' description='Collection of string values to filter by' required=true)
        global List<String> filterValues;
        @InvocableVariable(label='Field API Name' description='API name of the field to filter by' required=true)
        global String fieldAPIName;
        @InvocableVariable(label='Allow Empty Collection' description='Allow the input record collection to be empty? Default is false')
        global Boolean allowEmptyCollection = false;
        @InvocableVariable(label='Case Sensitive' description='Perform case-sensitive matching? Default is false')
        global Boolean caseSensitive = false;
    }
    global class Result {
        @InvocableVariable(label='Filtered Records' description='Collection of records that match the filter criteria')
        global List<SObject> filteredRecords;
    }
}





Test class:
@isTest
private class BK_FilterCollectionByFieldTest {
    @isTest
    static void testFilterRecordsByField() {
        // Create sample accounts
        Account acc1 = new Account(Name = 'Test Account 1', AccountNumber = '123');
        Account acc2 = new Account(Name = 'Test Account 2', AccountNumber = '456');
        Account acc3 = new Account(Name = 'Test Account 3', AccountNumber = '789');
        insert new List<Account>{acc1, acc2, acc3};
        // Prepare request
        BK_FilterCollectionByField.Request request = new BK_FilterCollectionByField.Request();
        request.inputRecords = new List<SObject>{acc1, acc2, acc3};
        request.filterValues = new List<String>{'123', '789'};
        request.fieldAPIName = 'AccountNumber';
        request.caseSensitive = true;
        // Call the method
        List<BK_FilterCollectionByField.Result> results = BK_FilterCollectionByField.filterRecordsByField(
            new List<BK_FilterCollectionByField.Request>{request}
        );
        // Assert the results
        System.assertEquals(1, results.size(), 'Should return one result object');
        System.assertEquals(2, results[0].filteredRecords.size(), 'Should return two filtered records');
        Set<Id> expectedIds = new Set<Id>{acc1.Id, acc3.Id};
        Set<Id> resultIds = new Set<Id>();
        for(SObject sobj : results[0].filteredRecords) {
            resultIds.add(sobj.Id);
        }
        System.assertEquals(expectedIds, resultIds, 'Filtered records should match expected accounts');
    }
    @isTest
    static void testFilterRecordsByField_CaseInsensitive() {
        // Create sample accounts with varying case in AccountNumber
        Account acc1 = new Account(Name = 'Test Account 1', AccountNumber = 'abc');
        Account acc2 = new Account(Name = 'Test Account 2', AccountNumber = 'DEF');
        Account acc3 = new Account(Name = 'Test Account 3', AccountNumber = 'GHI');
        insert new List<Account>{acc1, acc2, acc3};
        // Prepare request
        BK_FilterCollectionByField.Request request = new BK_FilterCollectionByField.Request();
        request.inputRecords = new List<SObject>{acc1, acc2, acc3};
        request.filterValues = new List<String>{'Abc', 'def'};
        request.fieldAPIName = 'AccountNumber';
        request.caseSensitive = false;
        // Call the method
        List<BK_FilterCollectionByField.Result> results = BK_FilterCollectionByField.filterRecordsByField(
            new List<BK_FilterCollectionByField.Request>{request}
        );
        // Assert the results
        System.assertEquals(1, results.size(), 'Should return one result object');
        System.assertEquals(2, results[0].filteredRecords.size(), 'Should return two filtered records');
        Set<Id> expectedIds = new Set<Id>{acc1.Id, acc2.Id};
        Set<Id> resultIds = new Set<Id>();
        for(SObject sobj : results[0].filteredRecords) {
            resultIds.add(sobj.Id);
        }
        System.assertEquals(expectedIds, resultIds, 'Filtered records should match expected accounts');
    }
    @isTest
    static void testFilterRecordsByField_EmptyCollectionAllowed() {
        // Prepare request with empty inputRecords
        BK_FilterCollectionByField.Request request = new BK_FilterCollectionByField.Request();
        request.inputRecords = new List<SObject>();
        request.filterValues = new List<String>{'123', '789'};
        request.fieldAPIName = 'AccountNumber';
        request.allowEmptyCollection = true;
        // Call the method
        List<BK_FilterCollectionByField.Result> results = BK_FilterCollectionByField.filterRecordsByField(
            new List<BK_FilterCollectionByField.Request>{request}
        );
        // Assert the results
        System.assertEquals(1, results.size(), 'Should return one result object');
        System.assertEquals(0, results[0].filteredRecords.size(), 'Should return zero filtered records');
    }
    @isTest
    static void testFilterRecordsByField_ExceptionOnEmptyCollection() {
        // Prepare request with empty inputRecords
        BK_FilterCollectionByField.Request request = new BK_FilterCollectionByField.Request();
        request.inputRecords = new List<SObject>();
        request.filterValues = new List<String>{'123', '789'};
        request.fieldAPIName = 'AccountNumber';
        request.allowEmptyCollection = false;
        // Call the method and expect exception
        try {
            List<BK_FilterCollectionByField.Result> results = BK_FilterCollectionByField.filterRecordsByField(
                new List<BK_FilterCollectionByField.Request>{request}
            );
            System.assert(false, 'Expected an exception due to empty inputRecords');
        } catch (Exception ex) {
            System.assert(ex instanceof BK_FilterCollectionByField.FilterException, 'Expected a FilterException');
            System.assertEquals('Input record collection is required but empty.', ex.getMessage());
        }
    }
    @isTest
    static void testFilterRecordsByField_ExceptionOnEmptyFilterValues() {
        // Create sample accounts
        Account acc1 = new Account(Name = 'Test Account 1', AccountNumber = '123');
        insert acc1;
        // Prepare request with empty filterValues
        BK_FilterCollectionByField.Request request = new BK_FilterCollectionByField.Request();
        request.inputRecords = new List<SObject>{acc1};
        request.filterValues = new List<String>();
        request.fieldAPIName = 'AccountNumber';
        // Call the method and expect exception
        try {
            List<BK_FilterCollectionByField.Result> results = BK_FilterCollectionByField.filterRecordsByField(
                new List<BK_FilterCollectionByField.Request>{request}
            );
            System.assert(false, 'Expected an exception due to empty filterValues');
        } catch (Exception ex) {
            System.assert(ex instanceof BK_FilterCollectionByField.FilterException, 'Expected a FilterException');
            System.assertEquals('Filter values are required but empty.', ex.getMessage());
        }
    }
    @isTest
    static void testFilterRecordsByField_ExceptionOnEmptyFieldAPIName() {
        // Create sample accounts
        Account acc1 = new Account(Name = 'Test Account 1', AccountNumber = '123');
        insert acc1;
        // Prepare request with empty fieldAPIName
        BK_FilterCollectionByField.Request request = new BK_FilterCollectionByField.Request();
        request.inputRecords = new List<SObject>{acc1};
        request.filterValues = new List<String>{'123'};
        request.fieldAPIName = '';
        // Call the method and expect exception
        try {
            List<BK_FilterCollectionByField.Result> results = BK_FilterCollectionByField.filterRecordsByField(
                new List<BK_FilterCollectionByField.Request>{request}
            );
            System.assert(false, 'Expected an exception due to empty fieldAPIName');
        } catch (Exception ex) {
            System.assert(ex instanceof BK_FilterCollectionByField.FilterException, 'Expected a FilterException');
            System.assertEquals('Field to filter by is required but empty.', ex.getMessage());
        }
    }
}
.elementor-sticky--effects {
   background: #941841!important; 
}
selector.elementor-sticky--effects .elementor-container{
min-height: 80px !important;
}
selector .elementor-container{
    transition: all 2s !important;
}

selector.elementor-sticky--effects .my-img img {
    width: 90px;
}
selector .my-img img {
    transition: 0.4s all;
}
find . -maxdepth 1 -mtime +3900 -printf '%CY-%Cm-%Cd  %f\n' | sort
/**
 * @NApiVersion 2.1
 * @NScriptType Suitelet
 */
var addLineCounterId = 0;
var objLine = {};
var CLIENT_SCRIPT_FILE_ID = 22087;
define(['N/file', 'N/https', 'N/log', 'N/ui/message', 'N/query', 'N/record', 'N/render', 'N/runtime', 'N/ui/serverWidget', 'N/search', 'N/format', 'N/url', 'N/redirect'], main);


function main(fileModule, httpsModule, logModule, messageModule, queryModule, recordModule, renderModule, runtimeModule, serverWidgetModule, searchModule, formatModule, urlModule, redirectModule) {

    file = fileModule;
    https = httpsModule;
    log = logModule;
    message = messageModule;
    query = queryModule;
    record = recordModule;
    render = renderModule;

    runtime = runtimeModule;
    serverWidget = serverWidgetModule;
    url = urlModule;
    search = searchModule;
    format = formatModule;
    redirect = redirectModule;



    return {

        onRequest: function (context) {
            try {

                var domain = 'https://';
                domain += url.resolveDomain({
                    hostType: url.HostType.FORM,
                    accountId: runtime.accountId
                });


                log.debug('domain', domain)


                scriptURL = url.resolveScript({
                    scriptId: runtime.getCurrentScript().id,
                    deploymentId: runtime.getCurrentScript().deploymentId,
                    returnExternalUrl: false
                }); //returnExternalUrl
                log.debug('scriptURL', scriptURL);
                var objScript = runtime.getCurrentScript();
                backgroundImg = objScript.getParameter({
                    name: 'custscript_backgroundimg_p2p'
                });
                log.debug('backgroundImg', backgroundImg);
                //scriptURL = 'https://5693072-sb2.extforms.netsuite.com/app/site/hosting/scriptlet.nl?script=2650&deploy=1&compid=5693072_SB2&h=c670f0d963a4fdf8638f'
                if (context.request.method == 'POST') {

                    postRequestHandle(context);

                } else {

                    getRequestHandle(context);
                }
            } catch (up) {
                log.debug("Error Occurred:", up);
            }

        }

    }

}
function getRequestHandle(context) {
    var form = serverWidget.createForm({
        title: 'Purchase Comparison 2023 Vs 2024 ',
        hideNavBar: false
    });



    form.clientScriptFileId = CLIENT_SCRIPT_FILE_ID

    var start_dt = context.request.parameters.Start_Date

    var end_dt = context.request.parameters.End_Date
    form.addSubmitButton({
        label: "Download CSV"
    })

    var strt_field = form.addField({
        id: 'custpage_strt_dt',
        type: serverWidget.FieldType.DATE,
        label: 'Start Date'
    });

    if (start_dt) {
        strt_field.defaultValue = start_dt;
    } else {
        strt_field.defaultValue = "01/01/2024";
        start_dt = "01/01/2024";
    }


    var end_field = form.addField({
        id: 'custpage_end_dt',
        type: serverWidget.FieldType.DATE,
        label: 'End Date'
    });

    if (end_dt) {
        end_field.defaultValue = end_dt;
    } else {
        end_field.defaultValue = new Date();
        var date = new Date()

        var day = date.getDate();
        var month = date.getMonth() + 1; // Month starts from 0
        var year = date.getFullYear();

        // Pad day and month with leading zeros if needed
        day = (day < 10) ? '0' + day : day;
        month = (month < 10) ? '0' + month : month;

        // Return the formatted date
        end_dt = month + '/' + day + '/' + year;
    }

    strt_field.updateBreakType({
        breakType: serverWidget.FieldBreakType.STARTCOL
    });



    var htmlField = form.addField({
        id: 'custpage_field_html',
        type: serverWidget.FieldType.INLINEHTML,
        label: 'HTML'
    });
    htmlField.defaultValue = `
                        
                                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
                                <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
                                <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
                                <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
                                <!-- Select2 -->
                                <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
                            
                                
                                <script src="/ui/jquery/jquery-3.5.1.min.js"></script>
                                <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
                                
                        
                                <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
                                <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
                        
                                <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.7.7/xlsx.core.min.js"></script>
                        
                                <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/1.10.100/pdf.min.js"></script>
                                <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.6.347/pdf.worker.entry.min.js" ></script>
                                <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/1.10.100/pdf.worker.min.js"></script>
                                <script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
                        
                                <style type = "text/css"> 
                        
                                input[type="text"], input[type="search"], textarea, button {
                                    outline: none;
                                box-shadow:none !important;
                                border: 1px solid #ccc !important;
                                }
                              
                               
                                p, pre {
                                    font-size: 10pt;
                                }
                              
                                td, th { 
                                    font-size: 9pt;
                                    border: 2px;
                                
                                
                                }
                        
                                th {
                                    font-weight: bold;
                                    border: 1px ;	
                                    
                                            
                                }
                                
                                .loader {
                                    border: 16px solid #f3f3f3;
                                border-radius: 50%;
                                border-top: 16px solid teal;
                                border-right: 16px solid white;
                                border-bottom: 16px solid teal;
                                width: 100px;
                                height: 100px;
                                margin-top:-50px;
                        
                                -webkit-animation: spin 2s linear infinite;
                                animation: spin 2s linear infinite;
                                }
                        
                                @-webkit-keyframes spin {
                                    0% { -webkit-transform: rotate(0deg); }
                                    100% { -webkit-transform: rotate(360deg); }
                                }
                        
                                @keyframes spin {
                                    0% { transform: rotate(0deg); }
                                    100% { transform: rotate(360deg); }
                                }

                                .divScroll {
                                    overflow:scroll;
                                    height:100px;
                                    width:200px;
                                    }

                                body {margin:2em;}

                                
                                .tableFixHead {
                                    overflow-y: auto; /* make the table scrollable if height is more than 200 px  */
                                    height: 660px; /* gives an initial height of 200px to the table */
                                    width: 1795px;
                                    opacity: 1;
                                    

                                  }
                                  .tableFixHead th{
                                    position: sticky; /* make the table heads sticky */
                                    top: 0px; /* table head will be placed from the top of the table and sticks to it */
                                    background: #ADD8E6

                                  }
                                  .table { 
                                    width: 100%; 
                                    border-collapse: collapse; 
                                  }
                                  #wrapper {
                                    min-height: 100%; 
                                }
                                </style>		
                                
                                <div id='wrapper' class="tableFixHead"> 
                                <div id="divLoaderReq" class="w3-display-container" style="z-index:99999999;position:absolute;background-size:cover;background-color:#36202052;width:100%;height:480px;display:none;">
                                <div class="loader w3-display-middle" ></div>
                                </div> 
                                <table>
                              
                                <table id="backordersalesordertable" class="table table-striped table-bordered" cellspacing="0">
                                    <thead>
                                        <tr>
                                            <th style="width:30%">Vendor NAME</th>
                                            <th>Purchase 2023</th>
                                            <th>Purchase 2024</th>
                                            <th>Purchase 2023 VS 2024</th>
                                         
                                        </tr>
                                    </thead>

                                     <tbody id="tbodyLineItemView" style="width:100%;overflow:auto;">
                       
                                    </tbody>
                                   
                                   
                                </table>
                                   
                                
                                </div>
                                
                                
                                <script>	
                                $(document).ready(function () {


                                    var table = document.getElementById('backordersalesordertable');

                                    var requestPayload = {
                                        'function': 'GetPurchasecomparedata',
                                        'startdate':'`+ start_dt + `',
                                        'enddate':'`+ end_dt + `',
                                        'type':'inline'
                                    }
                                    var xhr_P = new XMLHttpRequest();
                                
                                    xhr_P.open('POST', '${scriptURL}', true);
                                
                                
                                    xhr_P.send(JSON.stringify(requestPayload));
                                
                                
                                
                                
                                
                                
                                    xhr_P.onload = function () {
                                
                                
                                        if (xhr_P.status === 200) {
                                
                                
                                
                                
                                            var fileExistsResponsePayload_boSo = JSON.parse(xhr_P.response);
                                            console.log("fileExistsResponsePayload_boSo", fileExistsResponsePayload_boSo);
                                            var count = 1;
                                            var i;
                                            var data = fileExistsResponsePayload_boSo.purchasecomparedetails;
                                            data.sort(function(a, b) {
                                                var vendorA = a.vendor.trim().toUpperCase(); // ignore leading space and case
                                                var vendorB = b.vendor.trim().toUpperCase(); // ignore leading space and case
                                                if (vendorA < vendorB) {
                                                    return -1;
                                                }
                                                if (vendorA > vendorB) {
                                                    return 1;
                                                }
                                                return 0; // names must be equal
                                            });
                                            for (i in fileExistsResponsePayload_boSo.purchasecomparedetails) {
                                                var newRow = table.insertRow(-1);
                                
                                                var newCell = newRow.insertCell(-1);
                                                newCell.innerHTML = data[i].vendor

                                                var newCell = newRow.insertCell(-1);
                                                newCell.innerHTML = (Math.round(Number(data[i].prev_purchase)*100)/100).toFixed(2);

                                                var newCell = newRow.insertCell(-1);
                                                newCell.innerHTML = (Math.round(Number(data[i].curr_purchase)*100)/100).toFixed(2);

                                                var newCell = newRow.insertCell(-1);
                                                newCell.innerHTML = (Math.round((Number(data[i].curr_purchase) - Number(data[i].prev_purchase))*100)/100).toFixed(2);

                                                count = count + 1;
                                            }
                                
                                
                                        }
                                    }
                                })
                            </script>
                        
                                `;

    htmlField.updateDisplayType({
        displayType: serverWidget.FieldDisplayType.INLINE
    });


    context.response.writePage(form);




}
function postRequestHandle(context) {
    log.debug("context.request", context.request.body);

    var body = context.request.body;

    // if (body.includes('submitter')) {

    //     log.debug("submitter")




    //     var End_date = context.request.parameters.custpage_enddate;
    //     var Start_date = context.request.parameters.custpage_startdate;
    //     log.debug('Start_date', Start_date)
    //     log.debug('End_date', End_date)
    //     var today = new Date(Start_date);

    //     log.debug("today", today)
    //     var yr = today.getFullYear();
    //     if (yr % 400 == 0 || (yr % 100 != 0 && yr % 4 == 0)) {
    //         if (today.getDate() == "29") {
    //             var prev_date = today.getDate() - 1;
    //         } else {
    //             var prev_date = today.getDate();
    //         }
    //     } else {
    //         var prev_date = today.getDate();
    //     }



    //     var prev_month = today.getMonth() + 1;

    //     var prev_year = today.getFullYear() - 1;
    //     if (prev_date < 10) prev_date = '0' + prev_date;
    //     if (prev_month < 10) prev_month = '0' + prev_month;

    //     var Start_Date = prev_month + '/' + prev_date + '/' + prev_year;



    //     var Enddate = new Date(End_date);

    //     var year = Enddate.getFullYear();
    //     if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)) {
    //         if (Enddate.getDate() == "29") {
    //             var end_date = Enddate.getDate() - 1;
    //         } else {
    //             var end_date = Enddate.getDate();
    //         }
    //     } else {
    //         var end_date = Enddate.getDate();
    //     }

    //     // var end_date = Enddate.getDate();

    //     var end_month = Enddate.getMonth() + 1;

    //     var end_year = Enddate.getFullYear() - 1;
    //     if (end_date < 10) end_date = '0' + end_date;
    //     if (end_month < 10) end_month = '0' + end_month;

    //     var End_Date = end_month + '/' + end_date + '/' + end_year;

    //     var curr_End_date = new Date();

    //     var curr_End_date1 = curr_End_date.getDate();

    //     var curr_End_month = curr_End_date.getMonth() + 1;

    //     var curr_End_year = curr_End_date.getFullYear() - 1;

    //     var today_curr_year = curr_End_date.getFullYear();
    //     if (curr_End_date1 < 10) curr_End_date1 = '0' + curr_End_date1;
    //     if (curr_End_month < 10) curr_End_month = '0' + curr_End_month;

    //     var CURR_End_Date = curr_End_month + '/' + curr_End_date1 + '/' + curr_End_year;

    //     var Todays_date = curr_End_month + '/' + curr_End_date1 + '/' + today_curr_year;

    //     var resultSet = new Array();

    //     resultSet.push('Customer Name,Annual Sales Projection, SALES 2023, COST 2023 , PROFIT 2023 , SALES 2024 , COST 2024 , PROFIT 2024   ,SALES 2023 VS 2024 ,COST 2023 VS 2024,PROFIT 2023 VS 2024 ');


    //     // if (Start_date && End_date) {
    //     //     var prev_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY')   AND ({item.internalid} > 0 AND {amount} > 0)  THEN {amount}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') THEN {creditamount} ELSE 0 END END";

    //     //     var prev_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";

    //     //     var curr_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {amount}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY')  THEN {creditamount} ELSE 0 END END";

    //     //     var curr_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";
    //     // } else {
    //     //     var prev_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0)  THEN {amount}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') THEN {creditamount} ELSE 0 END END";

    //     //     var prev_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";

    //     //     var curr_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {amount}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY')  THEN {creditamount} ELSE 0 END END";

    //     //     var curr_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";
    //     // }
    //     // log.debug("prev_sales", prev_sales)
    //     // log.debug("prev_cost", prev_cost)
    //     // log.debug("curr_sales", curr_sales)
    //     // log.debug("curr_cost", curr_cost)

    //     var transactionSearchObj = search.create({
    //         type: "transaction",
    //         filters:
    //             [
    //                 ["type", "anyof", "Journal", "CustInvc"],
    //                 "AND",
    //                 ["formulatext: {name}", "isnotempty", "none"],
    //                 "AND",
    //                 ["mainline", "any", ""],
    //                 "AND",
    //                 ["formulatext: {customer.internalid}", "isnotempty", ""],
    //                 "AND",
    //                 ["formulatext: {name}", "isnot", "1 MISCELLANEOUS"]
    //             ],
    //         columns:
    //             [
    //                 search.createColumn({
    //                     name: "entity",
    //                     summary: "GROUP",
    //                     label: "Name"
    //                 }),
    //                 search.createColumn({
    //                     name: "companyname",
    //                     sort: search.Sort.ASC,
    //                     join: "customer",
    //                     summary: "GROUP",
    //                     label: "Company Name"
    //                 }),
    //                 search.createColumn({
    //                     name: "formulanumeric1",
    //                     summary: "SUM",
    //                     formula: prev_sales,
    //                     label: "Formula (Numeric)"
    //                 }),
    //                 search.createColumn({
    //                     name: "formulanumeric2",
    //                     summary: "SUM",
    //                     formula: prev_cost,
    //                     label: "Formula (Numeric)"
    //                 }),
    //                 search.createColumn({
    //                     name: "formulanumeric3",
    //                     summary: "SUM",
    //                     formula: curr_sales,
    //                     label: "Formula (Numeric)"
    //                 }),
    //                 search.createColumn({
    //                     name: "formulanumeric4",
    //                     summary: "SUM",
    //                     formula: curr_cost,
    //                     label: "Formula (Numeric)"
    //                 }),
    //                 search.createColumn({
    //                     name: "custentity_annualsalesprojection",
    //                     join: "customer",
    //                     summary: "GROUP",
    //                     label: "Annual Sales Projection"
    //                 })

    //             ]
    //     });
    //     var searchResultCount = transactionSearchObj.runPaged().count;
    //     log.debug("transactionSearchObj result count", searchResultCount);


    //     transactionSearchObj.run().each(function (result) {

    //         var resultArr = new Array();


    //         //resultArr.push('\n"' + result.getValue({ name: "internalid", label: "internalid" }) + '"');

    //         var cus_name = result.getValue({
    //             name: "companyname",
    //             sort: search.Sort.ASC,
    //             join: "customer",
    //             summary: "GROUP",
    //             label: "Company Name"
    //         });


    //         // cus_name = cus_name.substring(cus_name.indexOf(' ') + 1);

    //         resultArr.push('\n"' + cus_name + '"');

    //         resultArr.push('"' + result.getValue({
    //             name: "custentity_annualsalesprojection",
    //             join: "customer",
    //             summary: "GROUP",
    //             label: "Annual Sales Projection"

    //         }) + '"');

    //         resultArr.push('"' + result.getValue({
    //             name: "formulanumeric1",
    //             summary: "SUM",
    //             formula: prev_sales,
    //             label: "Formula (Numeric)"
    //         }) + '"');

    //         resultArr.push('"' + result.getValue({
    //             name: "formulanumeric2",
    //             summary: "SUM",
    //             formula: prev_cost,
    //             label: "Formula (Numeric)"
    //         }) + '"');

    //         var prev_prof_col = Number(Number(result.getValue({
    //             name: "formulanumeric1",
    //             summary: "SUM",
    //             formula: prev_sales,
    //             label: "Formula (Numeric)"
    //         })) - Number(result.getValue({
    //             name: "formulanumeric2",
    //             summary: "SUM",
    //             formula: prev_cost,
    //             label: "Formula (Numeric)"
    //         })))

    //         resultArr.push('"' + prev_prof_col + '"');

    //         resultArr.push('"' + result.getValue({
    //             name: "formulanumeric3",
    //             summary: "SUM",
    //             formula: curr_sales,
    //             label: "Formula (Numeric)"
    //         }) + '"');

    //         resultArr.push('"' + result.getValue({
    //             name: "formulanumeric4",
    //             summary: "SUM",
    //             formula: curr_cost,
    //             label: "Formula (Numeric)"
    //         }) + '"');

    //         ;

    //         var curr_profit_col = Number(Number(Number(result.getValue({
    //             name: "formulanumeric3",
    //             summary: "SUM",
    //             formula: curr_sales,
    //             label: "Formula (Numeric)"
    //         })) - Number(result.getValue({
    //             name: "formulanumeric4",
    //             summary: "SUM",
    //             formula: curr_cost,
    //             label: "Formula (Numeric)"
    //         }))))


    //         resultArr.push('"' + curr_profit_col + '"');


    //         var sales_compare = Number(result.getValue({
    //             name: "formulanumeric3",
    //             summary: "SUM",
    //             formula: curr_sales,
    //             label: "Formula (Numeric)"
    //         })) - Number(result.getValue({
    //             name: "formulanumeric1",
    //             summary: "SUM",
    //             formula: prev_sales,
    //             label: "Formula (Numeric)"
    //         }))

    //         var cost_compare = Number(result.getValue({
    //             name: "formulanumeric4",
    //             summary: "SUM",
    //             formula: curr_cost,
    //             label: "Formula (Numeric)"
    //         })) - Number(result.getValue({
    //             name: "formulanumeric2",
    //             summary: "SUM",
    //             formula: prev_cost,
    //             label: "Formula (Numeric)"
    //         }))

    //         var profit_compare = Number(curr_profit_col) - Number(prev_prof_col)



    //         resultArr.push('"' + sales_compare + '"');

    //         resultArr.push('"' + cost_compare + '"');

    //         resultArr.push('"' + profit_compare + '"');




    //         resultSet.push(resultArr);

    //         return true;


    //     })


    //     var fname = 'Sales Comparison Report.csv';



    //     // Write to a CSV file

    //     var fileObj = file.create({

    //         name: fname,

    //         fileType: file.Type.CSV,

    //         contents: resultSet.join('')

    //     });

    //     // Accounting > Closing Month > Invoice Corrections

    //     fileObj.folder = -15;

    //     var fileid = fileObj.save();

    //     log.debug("fileid", fileid)

    //     var filePath = file.load({

    //         id: fileid

    //     });

    //     // var url = filePath.url;

    //     //   window.open(url, '_blank');

    //     context.response.writeFile(filePath)







    // }
    // else {

        var requestPayload = JSON.parse(context.request.body);
        log.debug("requestPayload", requestPayload)

        context.response.setHeader('Content-Type', 'application/json');
       
        switch (requestPayload['function']) {

            case 'GetPurchasecomparedata':
                return GetPurchasecomparedata(context, requestPayload);
                break;



        }
   // }


}


function GetPurchasecomparedata(context, requestPayload) {
    log.debug("inside func reqpayload", requestPayload)
    var purchasecomparedetails = [];

    /*
    purchaseorderSearchObj.id="customsearch1664932756807";
    purchaseorderSearchObj.title="Transaction Search (copy)";
    var newSearchId = purchaseorderSearchObj.save();
    */


    var Start_date = requestPayload.startdate

    var End_date = requestPayload.enddate;






    var today = new Date(Start_date);

    log.debug("today", today)
    var yr = today.getFullYear();
    if (yr % 400 == 0 || (yr % 100 != 0 && yr % 4 == 0)) {
        if (today.getDate() == "29") {
            var prev_date = today.getDate() - 1;
        } else {
            var prev_date = today.getDate();
        }
    } else {
        var prev_date = today.getDate();
    }



    var prev_month = today.getMonth() + 1;

    var prev_year = today.getFullYear() - 1;
    if (prev_date < 10) prev_date = '0' + prev_date;
    if (prev_month < 10) prev_month = '0' + prev_month;

    var Start_Date = prev_month + '/' + prev_date + '/' + prev_year;



    var Enddate = new Date(End_date);

    var year = Enddate.getFullYear();
    if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)) {
        if (Enddate.getDate() == "29") {
            var end_date = Enddate.getDate() - 1;
        } else {
            var end_date = Enddate.getDate();
        }
    } else {
        var end_date = Enddate.getDate();
    }

    // var end_date = Enddate.getDate();

    var end_month = Enddate.getMonth() + 1;

    var end_year = Enddate.getFullYear() - 1;
    if (end_date < 10) end_date = '0' + end_date;
    if (end_month < 10) end_month = '0' + end_month;

    var End_Date = end_month + '/' + end_date + '/' + end_year;

    var curr_End_date = new Date();

    var curr_End_date1 = curr_End_date.getDate();

    var curr_End_month = curr_End_date.getMonth() + 1;

    var curr_End_year = curr_End_date.getFullYear() - 1;

    var today_curr_year = curr_End_date.getFullYear();
    if (curr_End_date1 < 10) curr_End_date1 = '0' + curr_End_date1;
    if (curr_End_month < 10) curr_End_month = '0' + curr_End_month;

    var CURR_End_Date = curr_End_month + '/' + curr_End_date1 + '/' + curr_End_year;

    var Todays_date = curr_End_month + '/' + curr_End_date1 + '/' + today_curr_year;
    log.debug("Todays_date",Todays_date)

    if (Start_date && End_date) {

        log.debug("if condition")

        var prev_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY')  THEN {amount}  ELSE 0 END"

        var curr_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY')  THEN {amount}  ELSE 0 END "
    } else {
        log.debug("else condition")
        var prev_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY')  THEN {amount}  ELSE 0 END"

        var curr_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY')  THEN {amount}  ELSE 0 END "

    }
    log.debug("prev_cost", prev_cost)
    log.debug("curr_cost", curr_cost)
  


    var transactionSearchObj = search.create({
        type: "vendorbill",
        settings: [{ "name": "consolidationtype", "value": "ACCTTYPE" }],
        filters:
            [
                ["type", "anyof", "VendBill"],
                "AND",
                ["mainline", "any", ""],
                "AND",
                ["formulatext: {name}", "isnotempty", ""]
            ],
        columns:
            [

                search.createColumn({
                    name: "formulatext",
                    summary: "GROUP",
                    formula: "{name}",
                    label: "Formula (Text)"
                }),
                search.createColumn({
                    name: "amount",
                    summary: "SUM",
                    label: "Amount"
                }),
                search.createColumn({
                    name: "formulanumeric1",
                    summary: "SUM",
                    formula: prev_cost,
                    label: "Formula (Numeric)"
                }),
                search.createColumn({
                    name: "formulanumeric2",
                    summary: "SUM",
                    formula: curr_cost,
                    label: "Formula (Numeric)"
                })
            ]
    });
    var searchResultCount = transactionSearchObj.runPaged().count;
    log.debug("transactionSearchObj result count", searchResultCount);

    var start = 0;
    var end = 1000;

    //srch.run().each(function(result)
    do {
        // if (searchResultCount < end) {
        //     end = searchResultCount;
        // }
        log.debug({
            title: 'end',
            details: end
        })
        var result = transactionSearchObj.run().getRange({
            start: start,
            end: end
        });
        log.debug("result", result)

        for (var i = 0; i < result.length; i++) {
            var soSearchobj = new Object();
          
            soSearchobj.vendor = ("" + result[i].getValue({
                name: "formulatext",
                summary: "GROUP",
                formula: "{name}",
                label: "Formula (Text)"
            })).replace(/^\d+/, '');

      
            soSearchobj.prev_purchase = result[i].getValue({
                name: "formulanumeric1",
                summary: "SUM",
                formula: "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('12/30/2023', 'MM/DD/YYYY')  THEN {amount}  ELSE 0 END ",
                label: "Formula (Numeric)"
            });

            soSearchobj.curr_purchase = result[i].getValue({
                name: "formulanumeric2",
                summary: "SUM",
                formula: "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('12/30/2024', 'MM/DD/YYYY')  THEN {amount}  ELSE 0 END ",
                label: "Formula (Numeric)"
            });




            purchasecomparedetails.push(soSearchobj)


        }
        end += 1000;
        start += 1000;
        searchResultCount -= 1000;
    } while (searchResultCount > 0);
    log.debug("soSearchobj", purchasecomparedetails)


    responsePayload = {
        'purchasecomparedetails': purchasecomparedetails,


    };


    context.response.write(JSON.stringify(responsePayload, null, 5));




}



/**
 * @NApiVersion 2.1
 * @NScriptType Suitelet
 */
var addLineCounterId = 0;
var objLine = {};
var CLIENT_SCRIPT_FILE_ID = 22087;
define(['N/file', 'N/https', 'N/log', 'N/ui/message', 'N/query', 'N/record', 'N/render', 'N/runtime', 'N/ui/serverWidget', 'N/search', 'N/format', 'N/url', 'N/redirect'], main);


function main(fileModule, httpsModule, logModule, messageModule, queryModule, recordModule, renderModule, runtimeModule, serverWidgetModule, searchModule, formatModule, urlModule, redirectModule) {

    file = fileModule;
    https = httpsModule;
    log = logModule;
    message = messageModule;
    query = queryModule;
    record = recordModule;
    render = renderModule;

    runtime = runtimeModule;
    serverWidget = serverWidgetModule;
    url = urlModule;
    search = searchModule;
    format = formatModule;
    redirect = redirectModule;



    return {

        onRequest: function (context) {
            try {

                var domain = 'https://';
                domain += url.resolveDomain({
                    hostType: url.HostType.FORM,
                    accountId: runtime.accountId
                });


                log.debug('domain', domain)


                scriptURL = url.resolveScript({
                    scriptId: runtime.getCurrentScript().id,
                    deploymentId: runtime.getCurrentScript().deploymentId,
                    returnExternalUrl: false
                }); //returnExternalUrl
                log.debug('scriptURL', scriptURL);
                var objScript = runtime.getCurrentScript();
                backgroundImg = objScript.getParameter({
                    name: 'custscript_backgroundimg_p2p'
                });
                log.debug('backgroundImg', backgroundImg);
                //scriptURL = 'https://5693072-sb2.extforms.netsuite.com/app/site/hosting/scriptlet.nl?script=2650&deploy=1&compid=5693072_SB2&h=c670f0d963a4fdf8638f'
                if (context.request.method == 'POST') {

                    postRequestHandle(context);

                } else {

                    getRequestHandle(context);
                }
            } catch (up) {
                log.debug("Error Occurred:", up);
            }

        }

    }

}
function getRequestHandle(context) {
    var form = serverWidget.createForm({
        title: 'Purchase Comparison 2023 Vs 2024 ',
        hideNavBar: false
    });



    form.clientScriptFileId = CLIENT_SCRIPT_FILE_ID

    var start_dt = context.request.parameters.Start_Date

    var end_dt = context.request.parameters.End_Date
    form.addSubmitButton({
        label: "Download CSV"
    })

    var strt_field = form.addField({
        id: 'custpage_strt_dt',
        type: serverWidget.FieldType.DATE,
        label: 'Start Date'
    });

    if (start_dt) {
        strt_field.defaultValue = start_dt;
    } else {
        strt_field.defaultValue = "01/01/2024";
        start_dt = "01/01/2024";
    }


    var end_field = form.addField({
        id: 'custpage_end_dt',
        type: serverWidget.FieldType.DATE,
        label: 'End Date'
    });

    if (end_dt) {
        end_field.defaultValue = end_dt;
    } else {
        end_field.defaultValue = new Date();
        var date = new Date()

        var day = date.getDate();
        var month = date.getMonth() + 1; // Month starts from 0
        var year = date.getFullYear();

        // Pad day and month with leading zeros if needed
        day = (day < 10) ? '0' + day : day;
        month = (month < 10) ? '0' + month : month;

        // Return the formatted date
        end_dt = month + '/' + day + '/' + year;
    }

    strt_field.updateBreakType({
        breakType: serverWidget.FieldBreakType.STARTCOL
    });



    var htmlField = form.addField({
        id: 'custpage_field_html',
        type: serverWidget.FieldType.INLINEHTML,
        label: 'HTML'
    });
    htmlField.defaultValue = `
                        
                                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
                                <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
                                <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
                                <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
                                <!-- Select2 -->
                                <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
                            
                                
                                <script src="/ui/jquery/jquery-3.5.1.min.js"></script>
                                <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
                                
                        
                                <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
                                <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
                        
                                <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.7.7/xlsx.core.min.js"></script>
                        
                                <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/1.10.100/pdf.min.js"></script>
                                <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.6.347/pdf.worker.entry.min.js" ></script>
                                <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/1.10.100/pdf.worker.min.js"></script>
                                <script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
                        
                                <style type = "text/css"> 
                        
                                input[type="text"], input[type="search"], textarea, button {
                                    outline: none;
                                box-shadow:none !important;
                                border: 1px solid #ccc !important;
                                }
                              
                               
                                p, pre {
                                    font-size: 10pt;
                                }
                              
                                td, th { 
                                    font-size: 9pt;
                                    border: 2px;
                                
                                
                                }
                        
                                th {
                                    font-weight: bold;
                                    border: 1px ;	
                                    
                                            
                                }
                                
                                .loader {
                                    border: 16px solid #f3f3f3;
                                border-radius: 50%;
                                border-top: 16px solid teal;
                                border-right: 16px solid white;
                                border-bottom: 16px solid teal;
                                width: 100px;
                                height: 100px;
                                margin-top:-50px;
                        
                                -webkit-animation: spin 2s linear infinite;
                                animation: spin 2s linear infinite;
                                }
                        
                                @-webkit-keyframes spin {
                                    0% { -webkit-transform: rotate(0deg); }
                                    100% { -webkit-transform: rotate(360deg); }
                                }
                        
                                @keyframes spin {
                                    0% { transform: rotate(0deg); }
                                    100% { transform: rotate(360deg); }
                                }

                                .divScroll {
                                    overflow:scroll;
                                    height:100px;
                                    width:200px;
                                    }

                                body {margin:2em;}

                                
                                .tableFixHead {
                                    overflow-y: auto; /* make the table scrollable if height is more than 200 px  */
                                    height: 660px; /* gives an initial height of 200px to the table */
                                    width: 1795px;
                                    opacity: 1;
                                    

                                  }
                                  .tableFixHead th{
                                    position: sticky; /* make the table heads sticky */
                                    top: 0px; /* table head will be placed from the top of the table and sticks to it */
                                    background: #ADD8E6

                                  }
                                  .table { 
                                    width: 100%; 
                                    border-collapse: collapse; 
                                  }
                                  #wrapper {
                                    min-height: 100%; 
                                }
                                </style>		
                                
                                <div id='wrapper' class="tableFixHead"> 
                                <div id="divLoaderReq" class="w3-display-container" style="z-index:99999999;position:absolute;background-size:cover;background-color:#36202052;width:100%;height:480px;display:none;">
                                <div class="loader w3-display-middle" ></div>
                                </div> 
                                <table>
                              
                                <table id="backordersalesordertable" class="table table-striped table-bordered" cellspacing="0">
                                    <thead>
                                        <tr>
                                            <th style="width:30%">Vendor NAME</th>
                                            <th>Purchase 2023</th>
                                            <th>Purchase 2024</th>
                                            <th>Purchase 2023 VS 2024</th>
                                         
                                        </tr>
                                    </thead>

                                     <tbody id="tbodyLineItemView" style="width:100%;overflow:auto;">
                       
                                    </tbody>
                                   
                                   
                                </table>
                                   
                                
                                </div>
                                
                                
                                <script>	
                                $(document).ready(function () {


                                    var table = document.getElementById('backordersalesordertable');

                                    var requestPayload = {
                                        'function': 'GetPurchasecomparedata',
                                        'startdate':'`+ start_dt + `',
                                        'enddate':'`+ end_dt + `',
                                        'type':'inline'
                                    }
                                    var xhr_P = new XMLHttpRequest();
                                
                                    xhr_P.open('POST', '${scriptURL}', true);
                                
                                
                                    xhr_P.send(JSON.stringify(requestPayload));
                                
                                
                                
                                
                                
                                
                                    xhr_P.onload = function () {
                                
                                
                                        if (xhr_P.status === 200) {
                                
                                
                                
                                
                                            var fileExistsResponsePayload_boSo = JSON.parse(xhr_P.response);
                                            console.log("fileExistsResponsePayload_boSo", fileExistsResponsePayload_boSo);
                                            var count = 1;
                                            var i;
                                            var data = fileExistsResponsePayload_boSo.purchasecomparedetails;
                                            data.sort(function(a, b) {
                                                var vendorA = a.vendor.trim().toUpperCase(); // ignore leading space and case
                                                var vendorB = b.vendor.trim().toUpperCase(); // ignore leading space and case
                                                if (vendorA < vendorB) {
                                                    return -1;
                                                }
                                                if (vendorA > vendorB) {
                                                    return 1;
                                                }
                                                return 0; // names must be equal
                                            });
                                            for (i in fileExistsResponsePayload_boSo.purchasecomparedetails) {
                                                var newRow = table.insertRow(-1);
                                
                                                var newCell = newRow.insertCell(-1);
                                                newCell.innerHTML = data[i].vendor

                                                var newCell = newRow.insertCell(-1);
                                                newCell.innerHTML = (Math.round(Number(data[i].prev_purchase)*100)/100).toFixed(2);

                                                var newCell = newRow.insertCell(-1);
                                                newCell.innerHTML = (Math.round(Number(data[i].curr_purchase)*100)/100).toFixed(2);

                                                var newCell = newRow.insertCell(-1);
                                                newCell.innerHTML = (Math.round((Number(data[i].curr_purchase) - Number(data[i].prev_purchase))*100)/100).toFixed(2);

                                                count = count + 1;
                                            }
                                
                                
                                        }
                                    }
                                })
                            </script>
                        
                                `;

    htmlField.updateDisplayType({
        displayType: serverWidget.FieldDisplayType.INLINE
    });


    context.response.writePage(form);




}
function postRequestHandle(context) {
    log.debug("context.request", context.request.body);

    var body = context.request.body;

    // if (body.includes('submitter')) {

    //     log.debug("submitter")




    //     var End_date = context.request.parameters.custpage_enddate;
    //     var Start_date = context.request.parameters.custpage_startdate;
    //     log.debug('Start_date', Start_date)
    //     log.debug('End_date', End_date)
    //     var today = new Date(Start_date);

    //     log.debug("today", today)
    //     var yr = today.getFullYear();
    //     if (yr % 400 == 0 || (yr % 100 != 0 && yr % 4 == 0)) {
    //         if (today.getDate() == "29") {
    //             var prev_date = today.getDate() - 1;
    //         } else {
    //             var prev_date = today.getDate();
    //         }
    //     } else {
    //         var prev_date = today.getDate();
    //     }



    //     var prev_month = today.getMonth() + 1;

    //     var prev_year = today.getFullYear() - 1;
    //     if (prev_date < 10) prev_date = '0' + prev_date;
    //     if (prev_month < 10) prev_month = '0' + prev_month;

    //     var Start_Date = prev_month + '/' + prev_date + '/' + prev_year;



    //     var Enddate = new Date(End_date);

    //     var year = Enddate.getFullYear();
    //     if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)) {
    //         if (Enddate.getDate() == "29") {
    //             var end_date = Enddate.getDate() - 1;
    //         } else {
    //             var end_date = Enddate.getDate();
    //         }
    //     } else {
    //         var end_date = Enddate.getDate();
    //     }

    //     // var end_date = Enddate.getDate();

    //     var end_month = Enddate.getMonth() + 1;

    //     var end_year = Enddate.getFullYear() - 1;
    //     if (end_date < 10) end_date = '0' + end_date;
    //     if (end_month < 10) end_month = '0' + end_month;

    //     var End_Date = end_month + '/' + end_date + '/' + end_year;

    //     var curr_End_date = new Date();

    //     var curr_End_date1 = curr_End_date.getDate();

    //     var curr_End_month = curr_End_date.getMonth() + 1;

    //     var curr_End_year = curr_End_date.getFullYear() - 1;

    //     var today_curr_year = curr_End_date.getFullYear();
    //     if (curr_End_date1 < 10) curr_End_date1 = '0' + curr_End_date1;
    //     if (curr_End_month < 10) curr_End_month = '0' + curr_End_month;

    //     var CURR_End_Date = curr_End_month + '/' + curr_End_date1 + '/' + curr_End_year;

    //     var Todays_date = curr_End_month + '/' + curr_End_date1 + '/' + today_curr_year;

    //     var resultSet = new Array();

    //     resultSet.push('Customer Name,Annual Sales Projection, SALES 2023, COST 2023 , PROFIT 2023 , SALES 2024 , COST 2024 , PROFIT 2024   ,SALES 2023 VS 2024 ,COST 2023 VS 2024,PROFIT 2023 VS 2024 ');


    //     // if (Start_date && End_date) {
    //     //     var prev_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY')   AND ({item.internalid} > 0 AND {amount} > 0)  THEN {amount}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') THEN {creditamount} ELSE 0 END END";

    //     //     var prev_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";

    //     //     var curr_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {amount}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY')  THEN {creditamount} ELSE 0 END END";

    //     //     var curr_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";
    //     // } else {
    //     //     var prev_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0)  THEN {amount}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') THEN {creditamount} ELSE 0 END END";

    //     //     var prev_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";

    //     //     var curr_sales = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {amount}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY')  THEN {creditamount} ELSE 0 END END";

    //     //     var curr_cost = "CASE WHEN {type} = 'Invoice' THEN CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') AND ({item.internalid} > 0 AND {amount} > 0) THEN {costestimate}  ELSE 0 END ELSE CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY') THEN {debitamount} ELSE 0 END END";
    //     // }
    //     // log.debug("prev_sales", prev_sales)
    //     // log.debug("prev_cost", prev_cost)
    //     // log.debug("curr_sales", curr_sales)
    //     // log.debug("curr_cost", curr_cost)

    //     var transactionSearchObj = search.create({
    //         type: "transaction",
    //         filters:
    //             [
    //                 ["type", "anyof", "Journal", "CustInvc"],
    //                 "AND",
    //                 ["formulatext: {name}", "isnotempty", "none"],
    //                 "AND",
    //                 ["mainline", "any", ""],
    //                 "AND",
    //                 ["formulatext: {customer.internalid}", "isnotempty", ""],
    //                 "AND",
    //                 ["formulatext: {name}", "isnot", "1 MISCELLANEOUS"]
    //             ],
    //         columns:
    //             [
    //                 search.createColumn({
    //                     name: "entity",
    //                     summary: "GROUP",
    //                     label: "Name"
    //                 }),
    //                 search.createColumn({
    //                     name: "companyname",
    //                     sort: search.Sort.ASC,
    //                     join: "customer",
    //                     summary: "GROUP",
    //                     label: "Company Name"
    //                 }),
    //                 search.createColumn({
    //                     name: "formulanumeric1",
    //                     summary: "SUM",
    //                     formula: prev_sales,
    //                     label: "Formula (Numeric)"
    //                 }),
    //                 search.createColumn({
    //                     name: "formulanumeric2",
    //                     summary: "SUM",
    //                     formula: prev_cost,
    //                     label: "Formula (Numeric)"
    //                 }),
    //                 search.createColumn({
    //                     name: "formulanumeric3",
    //                     summary: "SUM",
    //                     formula: curr_sales,
    //                     label: "Formula (Numeric)"
    //                 }),
    //                 search.createColumn({
    //                     name: "formulanumeric4",
    //                     summary: "SUM",
    //                     formula: curr_cost,
    //                     label: "Formula (Numeric)"
    //                 }),
    //                 search.createColumn({
    //                     name: "custentity_annualsalesprojection",
    //                     join: "customer",
    //                     summary: "GROUP",
    //                     label: "Annual Sales Projection"
    //                 })

    //             ]
    //     });
    //     var searchResultCount = transactionSearchObj.runPaged().count;
    //     log.debug("transactionSearchObj result count", searchResultCount);


    //     transactionSearchObj.run().each(function (result) {

    //         var resultArr = new Array();


    //         //resultArr.push('\n"' + result.getValue({ name: "internalid", label: "internalid" }) + '"');

    //         var cus_name = result.getValue({
    //             name: "companyname",
    //             sort: search.Sort.ASC,
    //             join: "customer",
    //             summary: "GROUP",
    //             label: "Company Name"
    //         });


    //         // cus_name = cus_name.substring(cus_name.indexOf(' ') + 1);

    //         resultArr.push('\n"' + cus_name + '"');

    //         resultArr.push('"' + result.getValue({
    //             name: "custentity_annualsalesprojection",
    //             join: "customer",
    //             summary: "GROUP",
    //             label: "Annual Sales Projection"

    //         }) + '"');

    //         resultArr.push('"' + result.getValue({
    //             name: "formulanumeric1",
    //             summary: "SUM",
    //             formula: prev_sales,
    //             label: "Formula (Numeric)"
    //         }) + '"');

    //         resultArr.push('"' + result.getValue({
    //             name: "formulanumeric2",
    //             summary: "SUM",
    //             formula: prev_cost,
    //             label: "Formula (Numeric)"
    //         }) + '"');

    //         var prev_prof_col = Number(Number(result.getValue({
    //             name: "formulanumeric1",
    //             summary: "SUM",
    //             formula: prev_sales,
    //             label: "Formula (Numeric)"
    //         })) - Number(result.getValue({
    //             name: "formulanumeric2",
    //             summary: "SUM",
    //             formula: prev_cost,
    //             label: "Formula (Numeric)"
    //         })))

    //         resultArr.push('"' + prev_prof_col + '"');

    //         resultArr.push('"' + result.getValue({
    //             name: "formulanumeric3",
    //             summary: "SUM",
    //             formula: curr_sales,
    //             label: "Formula (Numeric)"
    //         }) + '"');

    //         resultArr.push('"' + result.getValue({
    //             name: "formulanumeric4",
    //             summary: "SUM",
    //             formula: curr_cost,
    //             label: "Formula (Numeric)"
    //         }) + '"');

    //         ;

    //         var curr_profit_col = Number(Number(Number(result.getValue({
    //             name: "formulanumeric3",
    //             summary: "SUM",
    //             formula: curr_sales,
    //             label: "Formula (Numeric)"
    //         })) - Number(result.getValue({
    //             name: "formulanumeric4",
    //             summary: "SUM",
    //             formula: curr_cost,
    //             label: "Formula (Numeric)"
    //         }))))


    //         resultArr.push('"' + curr_profit_col + '"');


    //         var sales_compare = Number(result.getValue({
    //             name: "formulanumeric3",
    //             summary: "SUM",
    //             formula: curr_sales,
    //             label: "Formula (Numeric)"
    //         })) - Number(result.getValue({
    //             name: "formulanumeric1",
    //             summary: "SUM",
    //             formula: prev_sales,
    //             label: "Formula (Numeric)"
    //         }))

    //         var cost_compare = Number(result.getValue({
    //             name: "formulanumeric4",
    //             summary: "SUM",
    //             formula: curr_cost,
    //             label: "Formula (Numeric)"
    //         })) - Number(result.getValue({
    //             name: "formulanumeric2",
    //             summary: "SUM",
    //             formula: prev_cost,
    //             label: "Formula (Numeric)"
    //         }))

    //         var profit_compare = Number(curr_profit_col) - Number(prev_prof_col)



    //         resultArr.push('"' + sales_compare + '"');

    //         resultArr.push('"' + cost_compare + '"');

    //         resultArr.push('"' + profit_compare + '"');




    //         resultSet.push(resultArr);

    //         return true;


    //     })


    //     var fname = 'Sales Comparison Report.csv';



    //     // Write to a CSV file

    //     var fileObj = file.create({

    //         name: fname,

    //         fileType: file.Type.CSV,

    //         contents: resultSet.join('')

    //     });

    //     // Accounting > Closing Month > Invoice Corrections

    //     fileObj.folder = -15;

    //     var fileid = fileObj.save();

    //     log.debug("fileid", fileid)

    //     var filePath = file.load({

    //         id: fileid

    //     });

    //     // var url = filePath.url;

    //     //   window.open(url, '_blank');

    //     context.response.writeFile(filePath)







    // }
    // else {

        var requestPayload = JSON.parse(context.request.body);
        log.debug("requestPayload", requestPayload)

        context.response.setHeader('Content-Type', 'application/json');
       
        switch (requestPayload['function']) {

            case 'GetPurchasecomparedata':
                return GetPurchasecomparedata(context, requestPayload);
                break;



        }
   // }


}


function GetPurchasecomparedata(context, requestPayload) {
    log.debug("inside func reqpayload", requestPayload)
    var purchasecomparedetails = [];

    /*
    purchaseorderSearchObj.id="customsearch1664932756807";
    purchaseorderSearchObj.title="Transaction Search (copy)";
    var newSearchId = purchaseorderSearchObj.save();
    */


    var Start_date = requestPayload.startdate

    var End_date = requestPayload.enddate;






    var today = new Date(Start_date);

    log.debug("today", today)
    var yr = today.getFullYear();
    if (yr % 400 == 0 || (yr % 100 != 0 && yr % 4 == 0)) {
        if (today.getDate() == "29") {
            var prev_date = today.getDate() - 1;
        } else {
            var prev_date = today.getDate();
        }
    } else {
        var prev_date = today.getDate();
    }



    var prev_month = today.getMonth() + 1;

    var prev_year = today.getFullYear() - 1;
    if (prev_date < 10) prev_date = '0' + prev_date;
    if (prev_month < 10) prev_month = '0' + prev_month;

    var Start_Date = prev_month + '/' + prev_date + '/' + prev_year;



    var Enddate = new Date(End_date);

    var year = Enddate.getFullYear();
    if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0)) {
        if (Enddate.getDate() == "29") {
            var end_date = Enddate.getDate() - 1;
        } else {
            var end_date = Enddate.getDate();
        }
    } else {
        var end_date = Enddate.getDate();
    }

    // var end_date = Enddate.getDate();

    var end_month = Enddate.getMonth() + 1;

    var end_year = Enddate.getFullYear() - 1;
    if (end_date < 10) end_date = '0' + end_date;
    if (end_month < 10) end_month = '0' + end_month;

    var End_Date = end_month + '/' + end_date + '/' + end_year;

    var curr_End_date = new Date();

    var curr_End_date1 = curr_End_date.getDate();

    var curr_End_month = curr_End_date.getMonth() + 1;

    var curr_End_year = curr_End_date.getFullYear() - 1;

    var today_curr_year = curr_End_date.getFullYear();
    if (curr_End_date1 < 10) curr_End_date1 = '0' + curr_End_date1;
    if (curr_End_month < 10) curr_End_month = '0' + curr_End_month;

    var CURR_End_Date = curr_End_month + '/' + curr_End_date1 + '/' + curr_End_year;

    var Todays_date = curr_End_month + '/' + curr_End_date1 + '/' + today_curr_year;
    log.debug("Todays_date",Todays_date)

    if (Start_date && End_date) {

        log.debug("if condition")

        var prev_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_Date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_Date + "', 'MM/DD/YYYY')  THEN {amount}  ELSE 0 END"

        var curr_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('" + Start_date + "', 'MM/DD/YYYY') AND TO_DATE('" + End_date + "', 'MM/DD/YYYY')  THEN {amount}  ELSE 0 END "
    } else {
        log.debug("else condition")
        var prev_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('" + CURR_End_Date + "', 'MM/DD/YYYY')  THEN {amount}  ELSE 0 END"

        var curr_cost = "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('" + Todays_date + "', 'MM/DD/YYYY')  THEN {amount}  ELSE 0 END "

    }
    log.debug("prev_cost", prev_cost)
    log.debug("curr_cost", curr_cost)
  


    var transactionSearchObj = search.create({
        type: "vendorbill",
        settings: [{ "name": "consolidationtype", "value": "ACCTTYPE" }],
        filters:
            [
                ["type", "anyof", "VendBill"],
                "AND",
                ["mainline", "any", ""],
                "AND",
                ["formulatext: {name}", "isnotempty", ""]
            ],
        columns:
            [

                search.createColumn({
                    name: "formulatext",
                    summary: "GROUP",
                    formula: "{name}",
                    label: "Formula (Text)"
                }),
                search.createColumn({
                    name: "amount",
                    summary: "SUM",
                    label: "Amount"
                }),
                search.createColumn({
                    name: "formulanumeric1",
                    summary: "SUM",
                    formula: prev_cost,
                    label: "Formula (Numeric)"
                }),
                search.createColumn({
                    name: "formulanumeric2",
                    summary: "SUM",
                    formula: curr_cost,
                    label: "Formula (Numeric)"
                })
            ]
    });
    var searchResultCount = transactionSearchObj.runPaged().count;
    log.debug("transactionSearchObj result count", searchResultCount);

    var start = 0;
    var end = 1000;

    //srch.run().each(function(result)
    do {
        // if (searchResultCount < end) {
        //     end = searchResultCount;
        // }
        log.debug({
            title: 'end',
            details: end
        })
        var result = transactionSearchObj.run().getRange({
            start: start,
            end: end
        });
        log.debug("result", result)

        for (var i = 0; i < result.length; i++) {
            var soSearchobj = new Object();
          
            soSearchobj.vendor = ("" + result[i].getValue({
                name: "formulatext",
                summary: "GROUP",
                formula: "{name}",
                label: "Formula (Text)"
            })).replace(/^\d+/, '');

      
            soSearchobj.prev_purchase = result[i].getValue({
                name: "formulanumeric1",
                summary: "SUM",
                formula: "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2023', 'MM/DD/YYYY') AND TO_DATE('12/30/2023', 'MM/DD/YYYY')  THEN {amount}  ELSE 0 END ",
                label: "Formula (Numeric)"
            });

            soSearchobj.curr_purchase = result[i].getValue({
                name: "formulanumeric2",
                summary: "SUM",
                formula: "CASE WHEN {trandate} BETWEEN TO_DATE('01/01/2024', 'MM/DD/YYYY') AND TO_DATE('12/30/2024', 'MM/DD/YYYY')  THEN {amount}  ELSE 0 END ",
                label: "Formula (Numeric)"
            });




            purchasecomparedetails.push(soSearchobj)


        }
        end += 1000;
        start += 1000;
        searchResultCount -= 1000;
    } while (searchResultCount > 0);
    log.debug("soSearchobj", purchasecomparedetails)


    responsePayload = {
        'purchasecomparedetails': purchasecomparedetails,


    };


    context.response.write(JSON.stringify(responsePayload, null, 5));




}



Mathematics is a subject that challenges students worldwide, and the UK is no exception. With its intricate formulas, complex theorems, and detailed problem-solving techniques, math often becomes overwhelming for students. The pressure to excel in this subject, coupled with other academic responsibilities, leads many to seek out extra support. This guide will walk you through how to navigate mathematics assignments effectively and achieve academic success.

Understanding the Basics
Before delving into more advanced mathematical concepts, a strong foundation is essential. Many students struggle with assignments because they lack a clear understanding of basic mathematical principles. If you find yourself confused by a problem, it might be worth revisiting earlier material to reinforce these foundational skills.

Time Management is Key
Procrastination can be the downfall of many students when it comes to tackling complex math assignments. Start early, allocate specific time blocks for each task, and stick to a consistent study schedule. Breaking down assignments into smaller, manageable chunks makes the process less overwhelming and allows you to focus on one problem at a time.

Practice, Practice, Practice
One of the most effective ways to improve your skills in mathematics is through consistent practice. Try solving different variations of problems to understand the underlying patterns. This helps reinforce your grasp of concepts and ensures you're prepared for any problem that might come your way in an assignment.

Seeking Help When Needed
If you find yourself stuck on a particular problem, don't hesitate to ask for help. While collaborating with peers or turning to professors during office hours can be invaluable, there are also numerous online resources available. For students in the UK, platforms like MyAssignmentHelp.com offer access to expert guidance, where professional mathematicians and educators provide insight into difficult concepts and problem-solving techniques.

How to Approach Complex Problems
Mathematics assignments often involve problems that seem daunting at first glance. One effective strategy is to break the problem into smaller steps and solve each one individually. Additionally, always ensure you fully understand the question before starting; misinterpreting the task can lead to unnecessary errors.

Stay Organized
When working on mathematics assignments, organization is crucial. Keep your work neat, label each step clearly, and write down every formula and theorem used. Not only will this help you avoid mistakes, but it will also make it easier to review your work and understand where improvements can be made.

Utilize Resources Wisely
The UK is home to several academic libraries and institutions that offer valuable resources for mathematics students. Additionally, online tools and platforms can further support your learning. Websites like MyAssignmentHelp.com provide access to a wide range of study materials, past papers, and expert tutorials that can help demystify challenging topics.

Review and Reflect
Once you've completed your assignment, take the time to review your work thoroughly. Double-check calculations, ensure that each step logically follows the previous one, and make sure your answers are presented clearly. Reflection is an important part of the learning process—by identifying and correcting your mistakes, you’ll improve your problem-solving skills for future assignments.

Conclusion
Mastering mathematics assignments is a journey that requires dedication, practice, and effective strategies. By developing a strong understanding of basic concepts, managing your time, seeking help when necessary, and utilizing available resources, you can improve your mathematical abilities and approach each assignment with confidence. Remember, math may be challenging, but with the right mindset and tools, success is within reach for every student in the UK.
URL Reference: https://myassignmenthelp.com/uk/mathematics-assignment-help.html
//Step1: Implement these 3 Dependencies in build.gradle.kts(Module:app)

implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.5")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.5")
implementation("androidx.compose.material3:material3:1.3.0")

//Step2: Create CounterViewModel.kt

package com.example.incrementviewmodel

import androidx.lifecycle.ViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow

class CounterViewModel: ViewModel(){
    //Mutable State Flow to hold the counter value
    //StateFlow is a read only data stream
    private val _counter = MutableStateFlow(0)
    val counter : StateFlow<Int> = _counter

    fun incrementcounter(){
        _counter.value +=1
    }
}

//MainActivity.kt

package com.example.incrementviewmodel

import android.os.Bundle
import androidx.compose.foundation.layout.*//Import compose layout
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.lifecycle.ViewModel

import androidx.lifecycle.viewmodel.compose.viewModel//Import this

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContent {
            display()
        }
    }
}

@Composable
fun display(counterViewModel: CounterViewModel = viewModel()){
    val counterState = counterViewModel.counter.collectAsState()
    Column( modifier = Modifier.fillMaxSize(),
        horizontalAlignment = Alignment.CenterHorizontally,
        verticalArrangement = Arrangement.Center
    ) {
        Text(text = "Counter: ${counterState.value}")
        Spacer(modifier = Modifier.height(30.dp))
        Button(onClick = {counterViewModel.incrementcounter()}) {
            Text(text = "Increment")
        }
    }
}
package com.example.incrementcounter

import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.incrementcounter.ui.theme.IncrementCounterTheme

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContent {
            display()
        }
    }
}

@Composable
fun display(){
    var counter by remember { mutableIntStateOf(0) }
    Column( modifier = Modifier.fillMaxSize(),
            horizontalAlignment = Alignment.CenterHorizontally,
            verticalArrangement = Arrangement.Center
            ) {
        Text(text = "Counter: $counter")
        Spacer(modifier = Modifier.height(30.dp))
        Button(onClick = {counter++}) {
            Text(text = "Increment")
        }
        Button(onClick = {if(counter > 0) counter--}) {
            Text(text = "Decrement")
        }
    }
}

<!-- 1 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Wedding Event</title>
    <style>
        body {
            margin: 0;
            font-family: sans-serif;
        }

        h2 {
            text-align: center;
            padding: 20px 0;
        }

        #container {
            position: relative;
        }

        .image {
            width: 100%;
        }

        #overlay {
            overflow: hidden;
            transition: 1s ease;
            width: 0px;
            position: absolute;
            height: 100%;
            top: 0;
            left: 0;
            background-color: rgba(0, 0, 0, 0.7);
        }

        #text {
            text-align: justify;
            transform: translate(-270px, -100px);
            position: absolute;
            top: 0;
            left: 0;
            padding: 20px;
            color: white;
        }

        #container:hover #overlay {
            width: 100%;
        }
    </style>
</head>
<body>
    <h2>Wedding Event</h2>
    <div id="container">
        <img src="image.jpg" alt="Wedding" class="image">
        <div id="overlay">
            <div id="text">
                <p>A wedding is a ceremony where two people or a couple are united in marriage. Wedding traditions and customs vary greatly between cultures, ethnic groups, religions, countries, and social classes. Most wedding ceremonies involve an exchange of marriage vows by the couple, presentation of a gift (offering, ring(s), symbolic item, flowers, money), and a public proclamation of marriage by an authority figure or celebrant. Special wedding garments are often worn, and the ceremony is sometimes followed by a wedding reception. Music, poetry, prayers or readings from religious texts or literature are also commonly incorporated into the ceremony.</p>
            </div>
        </div>
    </div>
</body>
</html>


<!-- 2 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Events & Promotions</title>
    <style>
        body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
}

h2 {
    text-align: center;
    margin: 20px 0;
}

#title {
    margin: 20px;
    padding: 10px;
    background-color: #ddd;
    text-align: center;
    transform: rotate(-90deg);
    transform-origin: top left;
    display: inline-block;
}

.divContent {
    margin: 20px;
    padding: 10px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

        </style>
</head>
<body>
    <h2>EVENTS & PROMOTIONS</h2>

    <div id="title">Wedding Event</div>
    <div class="divContent">
        We intricately craft each and every proceeding of your wedding, be it a Christian nuptials or a Hindu vivaha or a Muslim nikkah. Our experts have hands-on experience in bringing your dreams to life, right from wedding cards design till the return gifts to the guests. Wedding is your day to indulge in pure love and happiness. Don't make it the day for your peak of tensions and hassles. We, as the leading wedding planners in the town, listen to and understand your budget and expectations for your princess's wedding.
    </div>

    <div id="title">Corporate Event</div>
    <div class="divContent">
        The first impression is the best impression, they say. We toil to bring that effect to your event among the public and to trend the industry. Be it corporate meetings, business seminars, award presentations or trade shows, we enrich it with fresh thinking, energetic personality and wealth of experience that we possess. You would experience the finest showcase of the event with us, to meet the needs of your esteemed clients.
    </div>

    <div id="title">Birthday Party</div>
    <div class="divContent">
        Planning a birthday party? Whether a wild party with friends or a crazy party for the kids, Most importantly, Purple7 helps you gather that ever-important catering services will be arranged as per your requirements and budget. Engage your guests in a variety of events. Host the party with a lively anchor. And we provide with many more options to make your birthday 'the talk of the town'.
    </div>
</body>
</html>
<!-- 1 -->
<!DOCTYPE html>
<html>
<head>
    <title>Event Schedule</title>
    <style>
        .outer-div {
            background-color: lightgreen;
            padding: 100px 5px 100px 5px;
        }

        .first {
            background-color: lightblue;
            padding: 5px 100px;
        }

        .second {
            background-color: pink;
            padding: 10px 50px;
        }

        .third {
            background-color: yellow;
            padding: 90px 30px;
        }
    </style>
</head>
<body>
    <h1>Event Schedule</h1>
    <div class="outer-div">
        <h3>Corporate Events</h3>
        <div class="first">
            <p>Event Management of team building events that develop and motivate teams in companies and corporations. Team building events are perfect for companies and their divisions to motivate their employees and to develop real teams.</p>
        </div>
    </div>
    <div class="outer-div">
        <h3>Wedding Planning</h3>
        <div class="second">
            <p>We provide Wedding Event Management Service as per requirements of customers. These services are rendered by professionals who have several years of work experience.</p>
        </div>
    </div>
    <div class="outer-div">
        <h3>Award Ceremony</h3>
        <div class="third">
            <p>Awards ceremonies are a celebration of talent, success and achievement. We've pulled together some of the things you need to consider when organising an awards ceremony.</p>
        </div>
    </div>
</body>
</html>

<!-- 2 -->
<!DOCTYPE html>
<html>
<head>
    <title>HoneyDew Events</title>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
</head>
<body>
    <div class="container">
        <h2>EVENTS & PROMOTIONS</h2>
        <p>Our company's core objective is, simply but, to be good. Built on the principles of transparency and accountability, we work dedicatedly on designing bespoke solutions that are creative, feasible, efficient, meticulously planned and successfully implemented. We offer a range of solutions from product launches, gala dinners & conferences to theme nights, fashion shows, hostesses & models. Our events team handles all your requirements from conceptualization to execution, leaving you free to focus completely on achieving your objectives. With proper planning and logistics management and the ability to activate requisite resources, we have undertaken a wide variety of projects. Our professional operations team will manage every aspect of your event, from invitations and RSVPs, branding, sound, light and technical solutions, to local and international entertainment and event staff. With dedicated suppliers in place we are able to handle any event requirement our clients may have. Our specialized promotions department specifically focuses on providing clients with promoters, hostesses and models for marketing campaigns, events, exhibitions and fashion shows. We provide complete services covering selection, casting, training, supervision and reporting. We intricately craft each and every proceeding of your wedding, be it a Christian nuptials or a Hindu vivaha or a Muslim nikkah. Our experts have hands-on experience in bringing your dreams to life, right from wedding cards design till the return gifts to the guests. Wedding is your day to indulge in pure love and happiness..Don't make it the day for your peak of tensions and hassles. We, as the leading wedding planners in the town, listen to and understand your budget and expectations on your princess's wedding. Your dream will be brought to reality with utmost care under your own budget. And what else, free your mind from tensions..Just stretch out and watch your princess joining her hands with her prince, with a happy and tension-free face.</p>
        <div class="contact-info">
            <h3>Contact Us..</h3>
            <h3>Let's talk about your event plan..</h3>
                <i class="fa fa-home"></i>
                <p>0422-2727272</p>
                <i class="fa fa-phone"></i>
                <p>+91 9360001060 | +918608101110</p>
                <i class="fa fa-envelope"></i>
                <p>info@purple7.in</p>
                <i class="fa fa-address-book"></i>
                <p>196/4, Sathy Road, above Union Bank, Saravanampatti, Coimbatore, Tamil Nadu - 641035, India</p>
      
        </div>
    </div>
</body>
</html>
<!-- 1 -->
<!DOCTYPE html>
<html>
<head>
<style>
/*Fill you text here*/
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    border: 1px solid #000000;
    padding: 8px;
    text-align: left;
}

thead th {
    background-color: #f2f2f2;
}

tbody tr:nth-child(odd) {
    background-color: #b3edcf;
}

tbody tr:nth-child(even) {
    background-color: #e0f0e9;
}
</style>
</head>
<body>
<center>
  <h1>Event Schedule</h1>
  <div>          
		<table>
		<tr><th>Name</th><th>Venue</th><th>Start Time</th><th>End Time</th></tr>
		<tr><td>Corporate Events</td><td>RVS Hall, 3rd Floor</td><td>4.5.2018 9.00AM</td><td>4.5.2018 12.00AM</td></tr>
		<tr><td>Wedding Planning</td><td>Sri Plus Thirumana Mahal</td><td>1.1.2019 7.00AM</td><td>1.1.2019 9.00AM</td></tr>
		<tr><td>Product Launches</td><td>RVS Hall, 2nd Floor</td><td>4.5.2018 2.00PM</td><td>4.5.2018 5.00PM</td></tr>
		<tr><td>Seminor on Cloud Computing</td><td>Vivekanandha Auditorium</td><td>18.12.2018 8.30AM</td><td>18.12.2018 1.00PM</td></tr>
		<tr><td>Heavenly Fashion</td><td>Bath Record Office</td><td>21.3.2018 5.00PM</td><td>21.3.2018 8.00PM</td></tr>
		<tr><td>Gala Dinners</td><td>City Tower, Hall No 2</td><td>12.1.2018 7.00 PM</td><td>12.1.2018 10.00 PM</td></tr>
		<tr><td>Award Ceremony</td><td>Hindustan Auditorium</td><td>11.11.2018 9.00 AM</td><td>11.11.2018 5.00 PM</td></tr>
		</table>
  </div>
</center>
</body>
</html>

<!-- 2 -->

<!DOCTYPE html>
<html>
<head>
    <title>Wedding Planner</title>
    <style>
        table {
            border: 1px solid black;
            border-collapse: collapse;
        }

        td {
            padding: 0px;
        }

        .space1 {
            margin: 150px 0px 0px 80px;
            background-color: lightgreen;
        }

        .space2 {
            margin: 150px 80px 0px 0px;
            background-color: lightblue;
        }

        .space3 {
            margin: 0px 0px 150px 80px;
            background-color: yellow;
        }

        .space4 {
            margin: 0px 80px 150px 0px;
            background-color: pink;
        }
    </style>
</head>
<body>
    <table>
        <tr>
            <td><div class="space1">A wedding planner is a professional who assists with the design, planning and management of a client's wedding.</div></td>
            <td><div class="space2">A wedding planner is a professional who assists with the design, planning and management of a client's wedding.</div></td>
        </tr>
        <tr>
            <td><div class="space3">A wedding planner is a professional who assists with the design, planning and management of a client's wedding.</div></td>
            <td><div class="space4">A wedding planner is a professional who assists with the design, planning and management of a client's wedding</div></td>
        </tr>
    </table>
</body>
</html>
<!-- contactUs.html -->
<!DOCTYPE html>
<html>
<head>
    <link href="StyleSheet.css" rel="stylesheet" type="text/css">
</head>
<body>
    <center>
        <h1>Pink Frag Event Organizer</h1><br>
    </center>
    <table width="100%">
        <tr>
            <td width="20%">
                <a id="home1" href="index.html">Home</a><br>
                <a id="events" href="events.html">Events</a><br>
                <a id="aboutus" href="aboutUs.html">About Us</a><br>
                <a id="contactus" href="contactUs.html">Contact Us</a><br>
            </td>

            <td width="80%" style="display: inline-block;margin-top: -20px;">
                <h2>Contact Us</h2>
                <p>14/509A,Sterlin Street,Nungambakkam, Chennai - 600034.</p>
                <p>Mobile : 9596645125</p>
                <p>Landline : 0422-2727272</p>
                <p>EMail : pinkfragOfficial@gmail.com</p>
            </td>
        </tr>
    </table>
</body>

</html>

<!-- aboutUs.html -->
<!DOCTYPE html>
<html>

<head>
    <link href="StyleSheet.css" rel="stylesheet" type="text/css">
</head>

<body>
    <center>
        <h1>Pink Frag Event Organizer</h1><br>
    </center>
    <table width="100%">
        <tr>
            <td width="20%">
                <a id="home1" href="index.html">Home</a><br>
                <a id="events" href="events.html">Events</a><br>
                <a id="aboutus" href="aboutUs.html">About Us</a><br>
                <a id="contactus" href="contactUs.html">Contact Us</a><br>
            </td>

            <td width="80%" style="display: inline-block;margin-top: -20px;">
                <h2>About Us</h2>
                <p>Pink Frag Event is a reputed organization,
                    which has come into being in 2009, as a Sole Proprietorship
                    Firm, with a sole aim of achieving the trust and support of
                    large customers. We have indulged our all endeavors towards
                    offering trustworthy Wedding Event Management, Promotional
                    Event Management, Birthday Party Management and many more.
                    To offer these services, we have hired specialized professionals, who are
                    capable of understanding as well as accomplishing the specific
                    customers’ desires.</p>
            </td>
        </tr>
    </table>
</body>

</html>

<!-- events.html -->
<!DOCTYPE html>
<html>

<head>
    <link href="StyleSheet.css" rel="stylesheet" type="text/css">
</head>

<body>
    <center>
        <h1>Pink Frag Event Organizer</h1><br>
    </center>
    <table width="100%">
        <tr style="display:inline-flex;">
            <td width="20%" style="display:inline;">
                <a id="home1" href="index.html">Home</a><br>
                <a id="events" class="index" name="index1" href="events.html">Events</a><br>
                <a id="aboutus" href="aboutUs.html">About Us</a><br>
                <a id="contactus" href="contactUs.html">Contact Us</a>
            </td>
            <td width="80%" style="display: inline-block;margin-top: -20px;">
                <h2>Events</h2>
                <h3>Corporate Events</h3>
                <p width="60%">A corporate event can be defined as a gathering that is sponsored by a business for its
                    employees, business partners, clients and/or prospective clients. These events can be for larger
                    audiences such as conventions or smaller events like conferences, meetings or holiday parties.</p>
                <h3>Wedding Planning</h3>
                <p>A wedding planner is a professional who assists with the design, planning and management of a
                    client's wedding. Weddings are significant events in people's lives and as such, couples are often
                    willing to spend considerable amount of money to ensure that their weddings are well-organized.
                    Wedding planners are often used by couples who work long hours and have little spare time available
                    for sourcing and managing wedding venues and wedding suppliers.</p>
                <h3>Product Launches</h3>
                <p>The debut of product into the market. The product launch signifies the point at which consumers first
                    have access to a new product.</p>
            </td>
        </tr>
    </table>
</body>

</html>

<!-- index.html -->
<!DOCTYPE html>
<html>

<head>
    <style>
        a {
            background-color: #00CED1;
            color: #000000;
            width: 100px;
            border: 1px solid #000000;
            padding: 15px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            margin-bottom: 5px;
        }

        a:hover {
            background-color: #4CAF50;
            color: #FFFFFF;
        }

        a:active {
            background-color: #F0E68C;
            color: #FF8C00;
        }
    </style>
</head>

<body>
    <center>
        <h1>Pink Frag Event Organizer</h1><br>
    </center>
    <table width="100%">
        <tr>
            <td width="20%">
                <a id="home1" href="index.html">Home</a><br>
                <a id="events" href="events.html">Events</a><br>
                <a id="aboutus" href="aboutUs.html">About Us</a><br>
                <a id="contactus" href="contactUs.html">Contact Us</a><br>
            </td>

            <td width="80%" style="display: inline-block;margin-top: -20px;">
                <h2>Pink Frag Event Organizer</h2>
                <p>We are indulged in offering a Promotional Event Management.
                    These services are provided by our team of professionals as
                    per the requirement of the client.
                    These services are highly praised for their features like
                    sophisticated technology, effective results and reliability. We offer
                    these services in a definite time frame and at affordable rates.</p>
            </td>
        </tr>
    </table>
</body>

</html>



<!-- 2nd question -->
<!DOCTYPE html>
<head>
    <style>
        img {
            display: block;
            margin: 20px auto;
            width: 80%;
            max-width: 600px;
        }
    </style>
</head>
<html>
<body>
    <h1>Wedding Album</h1>
    <img src="wedding.jpg" alt="Wedding Photo 1">
    <img src="wedding.jpg" alt="Wedding Photo 2" style="filter:grayscale(100%)">
</body>
</html>
<!-- 1 -->
<html>
<head>
    <style>
        body {
            font-family: Arial, sans-serif;
        }

        h1 {
            text-align: center;
            margin-bottom: 20px;
        }

        .content-box {
            background-color: #40E0D0;
            padding: 15px;
            margin: 10px 0;
        }

        .ellipsis-box {
            background-color: #40E0D0;
            padding: 15px;
            margin: 10px 0;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    </style>
</head>
<body>
    <h1>Wedding Event</h1>

    <div class="content-box">
        Our experts have hands on experience in bringing your dreams to life, right from wedding cards
        design till the return gifts to the guests.
    </div>

    <div class="ellipsis-box">
        Our experts have hands on experience in bringing your dreams to life, right from wedding cards
        design till the return gifts to the guests.
    </div>
</body>

</html>

<!-- 2 -->
<!DOCTYPE html>
<html>
    <head>
        <title>My First Website</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <style>
            body {
    background-image: url('bamboo.jpg');
    background-repeat: no-repeat;
    background-size: 100% ;
    font-family: Arial, sans-serif;
    padding: 20px;
}
</style>
    </head>
    <body>
        
        <h1>Pink Frag Event Organizer</h1>  
        <hr>
        <h2>Service Description</h2>
        <p>We are indulged in offering a Promotional Event Management. 
            These services are provided by our team of professionals as 
            per the requirement of the client. 
            These services are highly praised for their features like 
            sophisticated technology, effective results and reliability. We offer 
            these services in a definite time frame and at affordable rates.
        </p>
        <hr>
        <h2> Features</h2>
        <h5>Customized services</h5>
        <h5>On-time completion</h5>
        <h5>Execution in tandem with clients demand</h5>
        <hr>
        <h2>About Us</h2>
        <p> Pink Frag Event is a reputed organization, 
            which has come into being in 2009, as a Sole Proprietorship
            Firm, with a sole aim of achieving the trust and support of 
            large customers. We have indulged our all endeavors towards 
            offering trustworthy Wedding Event Management, Promotional
            Event Management, Birthday Party Management and many more. 
            All our services are reliable and offered keeping the exact 
            customers’ preferences and choice in mind. To offer these 
            services, we have hired specialized professionals, who are 
            capable of understanding as well as accomplishing the specific 
            customers’ desires. We have adopted modern technology, 
            to cope up with the challenges of industry. We keep all quality 
            parameters in mind, so that we cannot make any compromise in 
            terms of the excellence of products. </p>
        <hr>
        <h2>Contact Us</h2>
        <h3>Address</h3>
        <p>14/509A,Sterlin Street,Nungambakkam
        Chennai - 600034.</p>
        <h3>Mobile</h3>
        <p>Manager-9596645125</p>
        <h3>Landline</h3>
        <p>0422-2727272</p>
        <h3>EMail</h3>
        <p>pinkfragevent123@gmail.com   pinkfragOfficial@gmail.com
        </p>
    </body>
</html>
<!-- 1 -->
<!DOCTYPE html>
<html>
<body>
    <h1>Registration Form</h1>
    <form action="display.php" method="POST">
        <label for="name">Name:</label>
        <input type="text" id="name" name="name" required><br><br>

        <label for="userName">userName:</label>
        <input type="text" id="userName" name="userName" required><br><br>

        <label for="password">Password:</label>
        <input type="password" id="password" name="password" required><br><br>

        <label for="mobilenumber">Mobile Number:</label>
        <input type="text" id="mobilenumber" name="mobilenumber" maxlength="10" required><br><br>

        <label for="address">Address:</label>
        <textarea id="address" name="address" maxlength="200" required></textarea><br><br>

        <input type="submit" value="Register" name="register">
    </form>
</body>

</html>

<!-- 2 -->
<!DOCTYPE html>
<html>
 <body>
    <h1>Event Search</h1>
    <form action="search.php" method="GET">
        <label for="event">Enter an event:</label>
        <input type="text" id="event" name="someText" list="text" required>
        
        <datalist id="text">
            <option value="Bridal party">
            <option value="Engagement parties">
            <option value="Caterer">
            <option value="Wedding ceremony">
            <option value="Wedding reception">
        </datalist>
        <input type="submit" name="search" value="Search">
    </form>
</body>
</html>
<!-- 1 -->
<!DOCTYPE html>
<html>
    <body>
    <h1>Wedding and Events Planning</h1>

    <p>You can't imagine your wedding day without your best friends. So read our advice on how to choose your bridesmaids and groomsmen, get their duties in detail, and new bridesmaid and groomsmen gift ideas. Plus, read all you need to know about casting your very important extras -- from the flower girl to the ushers, readers, and candlelighters.</p>

    <ol>
        <li>Bridal party</li>
        <li>Engagement parties</li>
        <li>Caterer</li>
        <li>Wedding ceremony</li>
    </ol>

    <p>One of the most personal and important aspects of your wedding planning process will be choosing your wedding party! Your wedding party (also known as the bridal party) will include not only the people who will help you plan your big day, but they also are those you will want by your side when you walk down the aisle and say your vows. Typically your wedding party is made up of your sisters, brothers, and closest friends or family members. This page will serve as a guide to share all of the duties, roles, and responsibilities that are involved for each participant of the wedding party. Each individual member of the wedding party has unique responsibilities, so click on each of the roles below to read thorough explanations of those duties.</p>

    <ol start="5">
        <li>Seminars and Conferences</li>
        <li>Appreciation Events</li>
        <li>Team Building Events</li>
    </ol>

    <p>An engagement party is a party held to celebrate a couple's recent engagement and to help future wedding guests to get to know one another. Traditionally, the bride's parents host the engagement party, but many modern couples host their own celebration.</p>
</body>
</html>

<!-- 2 -->
<!DOCTYPE html>
<html>
    <body>
    <h1>Event Schedule List</h1>

    <div id="CommonEvents">
        <h2>Supported Events</h2>
        <ul type="circle">
            <li>Concerts</li>
            <li>Conferences</li>
            <li>Films</li>
            <li>Panel Debates</li>
            <li>Performances</li>
            <li>Seminars</li>
            <li>Talks & Discussions</li>
            <li>Workshops</li>
        </ul>
    </div>

    <div id="CorporateEvents">
        <h2>Corporate Events</h2>
        <ul type="square">
            <li>Team Building Events</li>
            <li>Trade Shows</li>
            <li>Business Dinners</li>
            <li>Networking Events</li>
            <li>Opening Ceremonies</li>
            <li>Product Launches</li>
            <li>Theme Parties</li>
            <li>Shareholder Meetings</li>
        </ul>
    </div>
</body>
</html>
<!-- index.html -->

<html lang="en">
<body>
    <h1>Pink Frag Event Organizer</h1>
    <table border="1">
        <tr>
            <td width="20%">
                <a href="index.html">Home</a>
                <a href="events.html">Events</a>
                <a href="aboutUs.html">About us</a>
                <a href="contactUs.html">Contact Us</a>
            </td>
            <td width="80%">
                <h2>Pink Frag Event Organizer</h2>
                <p>
                    We are indulged in offering a Promotional Event Management. These services are provided by our team
                    of
                    professionals as per the requirement of the client. These services are highly praised for their
                    features
                    like sophisticated technology, effective results, and reliability. We offer these services in a
                    definite
                    time frame and at affordable rates.
                </p>
            </td>
        </tr>
    </table>
</body>

</html>

<!-- events.html -->

<html lang="en">
<body>

    <h1>Pink Frag Event Organizer</h1>
    <table border="1">
        <tr>
            <td width="20%">
                <a href="index.html">Home</a>
                <a href="events.html">Events</a>
                <a href="aboutUs.html">About us</a>
                <a href="contactUs.html">Contact Us</a>
            </td>
            <h2>Events</h2>
            <h3>Corporate Events</h3>
            <td>
                <p>
                    A corporate event can be defined as a gathering that is sponsored by a business for its employees,
                    business partners,
                    clients and/or prospective clients.
                </p>
            </td>
            <h3>Wedding Planning</h3>
            <p>
                A wedding planner is a professional who assists with the design, planning, and management of a client's
                wedding.
                Weddings are significant events in people's lives, and as such, couples are often willing to spend
                considerable amounts
                of money to ensure that their weddings are well-organized. Wedding planners are often used by couples
                who work long hours
                and have little spare time available for sourcing and managing wedding venues and wedding suppliers.
            </p>
            <h3>Product Launches</h3>
            <p>
                The debut of a product into the market. The product launch signifies the point at which consumers first
                have access to a
                new product.
            </p>
        </tr>
    </table>
</body>
</html>

<!-- aboutus.html -->
 
<html lang="en">
<body>
    <h1>Pink Frag Event Organizer</h1>
    <table border="1">
        <tr>
          <td width="20%">
                <a href="index.html">Home</a>
                <a href="events.html">Events</a>
                <a href="aboutUs.html">About us</a>
                <a href="contactUs.html">Contact Us</a>
            </td>
            <td width="80%">
                <h2>About us</h2>
                <p>
                    Pink Frag Event is a reputed organization, which has come into being in 2009, as a Sole Proprietorship Firm,
                    with a sole aim of achieving the trust and support of large customers. We have indulged our all endeavors
                    towards offering trustworthy Wedding Event Management, Promotional Event Management, Birthday Party Management
                    and many more. To offer these services, we have hired specialized professionals, who are capable of understanding
                    as well as accomplishing the specific customers’ desires.
                </p>
            </td>
        </tr>
    </table>

</body>
</html>

<!-- contactus.html -->
<html>
<body>
    <h1>Pink Frag Event Organizer</h1>
    <table border="1">
        <tr>
            <td width="20%">
                <a href="#">Home</a>
                <a href="#">Events</a>
                <a href="#">About us</a>
                <a href="#">Contact Us</a>
            </td>
            <td width="80%">
                <h2>Contact us</h2>
                <p>14/509A,Sterlin Street,Nungambakkam, Chennai - 600034.</p>
            </td>
        </tr>
    </table>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Pink Frag Event Management</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
        }
        table {
            width: 100%;
            border-collapse: collapse;
        }
        td {
            padding: 10px;
            border: 1px solid #ddd;
        }
        img {
            max-width: 100%;
            height: auto;
        }
        h1 {
            text-align: center;
        }
        .title {
            font-weight: bold;
            margin-bottom: 10px;
        }
    </style>
</head>
<body>
    <h1>Pink Frag Event Management</h1>
    <table id="eventTable">
        <!-- First Row -->
        <tr>
            <td colspan="1"><img src="eventLogo1.png" id="eventLogo1" alt="Event Logo 1"></td>
            <td colspan="4">Pink Frag Event Management</td>
            <td colspan="1"><img src="eventLogo2.png" id="eventLogo2" alt="Event Logo 2"></td>
        </tr>
        <!-- Second Row -->
        <tr>
            <td colspan="2">
                Event management is the application of project management to the creation and development of large scale events such as festivals, conferences, ceremonies, weddings, formal parties, concerts, or conventions. It involves studying the brand, identifying its target audience, and coordinating the technical aspects before actually launching the event.
            </td>
            <td colspan="2">
                The process of planning and coordinating the event is usually referred to as event planning and which can include budgeting, scheduling, site selection, acquiring necessary permits, coordinating transportation and parking, arranging for speakers or entertainers, arranging decor, event security, catering, coordinating with third party vendors, and emergency plans.
            </td>
            <td colspan="2">
                Each event is different in its nature, so process of planning & execution of each event differs on the basis of type of event. The events industry now includes events of all sizes from the Olympics down to business breakfast meetings. Many industries, charitable organizations, and interest groups hold events in order to market themselves or celebrate an achievement.
            </td>
        </tr>
        <!-- Third Row -->
        <tr>
            <td colspan="3">
                <div class="title">Wedding Planner</div>
                A wedding planner is a professional who assists with the design, planning and management of a client's wedding. Weddings are significant events in people's lives and as such, couples are often willing to spend a considerable amount of money to ensure that their weddings are well-organized.
            </td>
            <td colspan="3">
                <div class="title">Corporate Event</div>
                A corporate event can be defined as a gathering that is sponsored by a business for its employees, business partners, clients and/or prospective clients. These events can be for larger audiences such as conventions or smaller events like conferences, meetings or holiday parties.
            </td>
        </tr>
    </table>
</body>
</html>
<!-- 1 -->
<!DOCTYPE html>
<html>
    <body>
            <h1>Pink Frag Event Organizer</h1>
            <img src="../images/Event_Picture.jpg" />
            <h2>Service Description</h2>
            <p>We are indulged in offering a Promotional Event Management. These services are provided by our team of professionals as per the requirement of the client. These services are highly praised for their features like sophisticated technology, effective results and reliability. We offer these services in a definite time frame and at affordable rates.</p>
    </body>
</html>

<!-- 2 -->

<!DOCTYPE html>
<html>
    <body>
            <h2>Events</h2>
            <picture>
                <source media="(min-width: 650px)" srcset="teamBuilding.jpg">
            <source media="(min-width: 500px)" srcset="weddingAlbum.jpg">
            <img src="newyear.jpg" alt="Event image" style="width:auto;">
            </picture>
    </body>
</html>
<!-- 1 -->
<!DOCTYPE html>
<html>
<h2>Wedding Event</h2>
<p>A wedding is a ceremony where two people or a couple are united in marriage. Wedding traditions and customs vary
    greatly between cultures, ethnic groups, religions, countries, and social classes. Most wedding ceremonies involve
    an exchange of marriage vows by the couple, presentation of a gift, and a public proclamation of marriage by an
    authority figure or celebrant. Special wedding garments are often worn, and the ceremony is sometimes followed by a
    wedding reception. Music, poetry, prayers or readings from religious texts or literature are also commonly
    incorporated into the ceremony.</p>
<blockquote cite="https://www.brainyquote.com/quotes/sheri_l_dew_679111">
    <q>Neither man nor woman is perfect or complete without the other. Thus, no marriage or family, no ward or stake is
        likely to reach its full potential until husbands and wives, mothers and fathers, men and women work together in
        unity of purpose, respecting and relying upon each other's strengths.</q>
</blockquote>
</html>


<!-- 2 -->
<html>
<head>
    <title>My First Website</title>
</head>
<body>
    <h1>Olympic Games</h1>

    <p>The modern <b>Olympic Games</b> or <b>Olympics</b> are leading international sporting events featuring summer and
        winter sports competitions in which thousands of <i>athletes</i> from around the world participate in a variety
        of competitions. The Olympic Games are considered the world's foremost sports competition with more than <i>200
            nations</i> participating. The Olympic Games are normally held every <u>four years</u>, alternating between
        the
        <u>Summer</u> and <u>Winter Olympics</u> every two years in the four-year period.
    </p>
    <p>Their creation was inspired by the <ins>ancient Olympic Games</ins>, held in Olympia, Greece from the 8th century
        BC
        to the 4th century AD. <mark>Baron Pierre de Coubertin</mark> founded the <ins>International Olympic
            Committee</ins> (IOC)
        in 1894, leading to the first modern Games in Athens in 1896. The IOC is the governing body of the Olympic
        Movement, with the <small>structure and authority</small> defined by the Olympic Charter.</p>
    <p>The evolution of the Olympic Movement during the <i>20<sup>th</sup> and 21<sup>st</sup></i> centuries has
        resulted in several changes to the Olympic Games. Some of these adjustments include the creation of the Winter
        Olympic Games for snow and ice sports, the Paralympic Games for athletes with disabilities, the Youth Olympic
        Games for athletes aged <sub>14 to 18</sub>, the five Continental games <big>(Pan American, African, Asian,
            European, and
            Pacific)</big>, and the World Games for sports that are not contested in the Olympic Games. The IOC also
        endorses the Deaflympics and the Special Olympics. The IOC has needed to adapt to a variety of
        <del>economic, political, and technological</del> advancements.
    </p>
    <p>The <tt>Olympic Movement consists of international sports federations (IFs), National Olympic Committees (NOCs),
            and <small>organising committees</small> for each specific Olympic Games.</tt></p>
</body>

</html>
            .title {
              border-radius: 16px;
              border: 1px solid #e8e9fb;
              box-shadow: 0 0 10px #e8e9fb;
              text-align: center;
              color: #12a3f5;
              width: fit-content;
              min-width: 80px;
              padding: 0 10px;
              position: relative;
              left: 50%;
              translate: -50%;
              margin-bottom: 6px;
              &:before {
                content: "";
                width: 300%;
                height: 2px;
                background: #e8e9fb;
                position: absolute;
                bottom: -6px;
                left: 50%;
                translate: -50%;
                background: linear-gradient(to right, rgba(255, 255, 255, 0) ,#e8e9fb,rgba(255, 255, 255, 0));
              }
            }
function customizer_register_cta_settings($wp_customize) {
    // Add a section for the CTA
    $wp_customize->add_section('cta_section', array(
        'title'    => __('CTA Settings', 'textdomain'),
        'priority' => 30,
    ));

    // Add a setting for the CTA Title
    $wp_customize->add_setting('cta_title', array(
        'default'           => __('If You Need Any Help Contact With Us', 'textdomain'),
        'sanitize_callback' => 'sanitize_text_field',
    ));

    // Add a control for the CTA Title
    $wp_customize->add_control('cta_title_control', array(
        'label'    => __('CTA Title', 'textdomain'),
        'section'  => 'cta_section',
        'settings' => 'cta_title',
        'type'     => 'text',
    ));

    // Add a setting for the phone number
    $wp_customize->add_setting('cta_phone_number', array(
        'default'           => __('343.909.3074', 'textdomain'),
        'sanitize_callback' => 'sanitize_text_field',
    ));

    // Add a control for the phone number
    $wp_customize->add_control('cta_phone_number_control', array(
        'label'    => __('Phone Number', 'textdomain'),
        'section'  => 'cta_section',
        'settings' => 'cta_phone_number',
        'type'     => 'text',
    ));
}

add_action('customize_register', 'customizer_register_cta_settings');
Did you know? VisualForce still can be very useful! ⚙️

🙏🏼 Thanks to Raman Bazyleu for this video where he shows how to generate a Word document using VisualForce. 🎖️

🔗 LINK: https://lnkd.in/gqhjK6Af
Pull
gsutil -m cp -r gs://us-central1-airflow-test-1-b4b7b1e0-bucket/dags/* ./local-dags/

Push
gsutil -m cp -r * gs://us-central1-airflow-test-1-b4b7b1e0-bucket/dags/
{
	"blocks": [
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":star: What's on in Melbourne this week! :star:"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n\n Hey Melbourne, happy Monday! Please see below for what's on this week. "
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": "Xero Café :coffee:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n :new-thing: *This week we are offering:* \n\n Footballer Cookies, AFL Cookies, Caramel Slice (GF) \n\n *Weekly Café Special*: _Matcha Latte_"
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": " Wednesday, 25th September :calendar-date-25:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n\n:fruits: *Afternoon Tea*: From *2pm* in the L3 kitchen + breakout space! \n\n:yoga2:*Wellbeing - Pilates*: Confirm your spot <https://docs.google.com/spreadsheets/d/1iKMQtSaawEdJluOmhdi_r_dAifeIg0JGCu7ZSPuwRbo/edit?gid=0#gid=0/|*here*>. Please note we have a maximum of 15 participants per class, a minimum notice period of 4 hours is required if you can no longer attend."
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": "Thursday, 26th September :calendar-date-26:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": ":breakfast: *Breakfast*: Provided by *Kartel Catering* from *8:30am - 10:30am* in the Wominjeka Breakout Space.\n\n :AFL: *AFL Grand Final BBQ Social+* from 4pm - 6pm"
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": ":connect: *Reminder - Boost Survey:* Our Boost Day feedback survey is live until the 1st of October 2024, give us your thoughts <https://yourvoice.xero.com/jfe/form/SV_eyA8ArYHfnsfUwu|*here*>. All responses are anonymous! \n\n Stay tuned to this channel for more details, and make sure you're subscribed to the <https://calendar.google.com/calendar/u/0?cid=Y19xczkyMjk5ZGlsODJzMjA4aGt1b3RnM2t1MEBncm91cC5jYWxlbmRhci5nb29nbGUuY29t|*Melbourne Social Calendar*> :party-wx:"
			}
		}
	]
}
create procedure generate_range(startvalue integer, endvalue integer)
    returns (seq integer)
as
begin
    seq = startvalue;
    suspend;

    while (seq < endvalue) do
    begin
        seq = seq + 1;
        suspend;
    end
end;

/* Ex: select seq from generate_range(1, 100); */
{
    "importId": "clay",
    "upsert": true,
    "queueForRender": true,
    "variables": {
        "originalData": {
        "first_name": 

First Name

,
        "company_name": 

Company Name

,
        "niche": 

Niche

,
        "location": 

Location

,
        "email": 

Email

,
        "website_0": 

Website

,
        "custom_2": 

Chat GPT

,
        "last_name": 

Last Name


   },
        "originalUid": 

Email

,
        "first_name": 

First Name

,
        "company_name": 

Company Name

,
        "email": 

Email

,
        "website_0": 

Website

,
        "custom_2": 

Chat GPT


 }
}
GET /api/v1/users/123
yeah_|WARNING:-DO-NOT-SHARE-THIS.--Sharing-this-will-allow-someone-to-log-in-as-you-and-to-steal-your-ROBUX-and-items.|_FEB2CE0170F0EED707AA532EA3030066EA89B105D85A08E82FDA9E867C212187BE5F84070A803896EA89874B1926B7DA7D616F20D2CD7FB9568AC09A33A62336395B899E506790B18371F0E8745EF778DF8DEC076B08B8154FB3CE9FD9EFD5D53EC03AC23D8EB50E463868B8529517333997A0B0CB16FDE514E21C71D73728F5AB0231318CCF92A56F1C7599BF95ED7840A76F43E7846DC6310700D752274C419F5725830B361F2D1DBEFD344929C8B158849B68A7DD60DB47ECCB8BA3FAF8AB13D0DE6C327F1C6287381F5BB381903FC6F3879189B21F725C9B79E8F32BE4DBBF18749CC5ED41F9CF365045E5E0FB679EEE769CE19C5F9EDF34A0A7F66E9354AD1C71F5AB0F8CDDEBA45F7DFD1FD545C64FD3BBC7BFC39FC71395309D22E1F1347AA2FA876AA5BE2E7B02522844D61ACEEF32CBE07FCEB9DDD9D1E1273F7587F8466CEE197C57ED3A95F698F1AF0B26C615D0AA638AA8826BE216864BDCDF7B2AB23FF30E12D67E8B1ECBF647A8289969410F51391AA3D56B1E01666ADFE9D164897910231A1DF13C13B512D5AA128090B462B3DB79D507896DBEBD21631BB792F7910C1DC5A43BEEB2B36634B7BE064F95F507E4374964BCEBDDA89883D1386EE7405F0B19339ACEDB7193128B70DDAC1DCFD61A25A84518E0DCC041C30B9209ED3E6DBFB7F45533B1017A4C319F887D85D785704BB17CF55893BF22BDD15E83F3CA890561B1AD010EC12136D794A9D98B1EFBE5EB693B637FE9AF619F3CC01C7521CA49903CABC7507BA4E03B359BE53C9E02ED6F34FE940CAA55D66ACF7DFEDEDF4426DEC411F16A1A3CC8FE1E25956C0DC3C17BA7C9826E45D051CA2F51FC6941D7B73D633341FCC9A1E0E8E7B087416338CDD7B730CE6F953C2F5EDD68D058B78EED9D223DB7BFC98AE22F51AE1F1393AF
struct Node {
    int key, value, cnt;
    Node *next; 
    Node *prev;
    Node(int _key, int _value) {
        key = _key;
        value = _value; 
        cnt = 1; 
    }
}; 
struct List {
    int size; 
    Node *head; 
    Node *tail; 
    List() {
        head = new Node(0, 0); 
        tail = new Node(0,0); 
        head->next = tail;
        tail->prev = head; 
        size = 0;
    }
    
    void addFront(Node *node) {
        Node* temp = head->next;
        node->next = temp;
        node->prev = head;
        head->next = node;
        temp->prev = node;
        size++; 
    }
    
    void removeNode(Node* delnode) {
        Node* delprev = delnode->prev;
        Node* delnext = delnode->next;
        delprev->next = delnext;
        delnext->prev = delprev;
        size--; 
    }
    
    
    
};
class LFUCache {
    map<int, Node*> keyNode; 
    map<int, List*> freqListMap; 
    int maxSizeCache;
    int minFreq; 
    int curSize; 
public:
    LFUCache(int capacity) {
        maxSizeCache = capacity; 
        minFreq = 0;
        curSize = 0; 
    }
    void updateFreqListMap(Node *node) {
        keyNode.erase(node->key); 
        freqListMap[node->cnt]->removeNode(node); 
        if(node->cnt == minFreq && freqListMap[node->cnt]->size == 0) {
            minFreq++; 
        }
        
        List* nextHigherFreqList = new List();
        if(freqListMap.find(node->cnt + 1) != freqListMap.end()) {
            nextHigherFreqList = freqListMap[node->cnt + 1];
        } 
        node->cnt += 1; 
        nextHigherFreqList->addFront(node); 
        freqListMap[node->cnt] = nextHigherFreqList; 
        keyNode[node->key] = node;
    }
    
    int get(int key) {
        if(keyNode.find(key) != keyNode.end()) {
            Node* node = keyNode[key]; 
            int val = node->value; 
            updateFreqListMap(node); 
            return val; 
        }
        return -1; 
    }
    
    void put(int key, int value) {
        if (maxSizeCache == 0) {
            return;
        }
        if(keyNode.find(key) != keyNode.end()) {
            Node* node = keyNode[key]; 
            node->value = value; 
            updateFreqListMap(node); 
        }
        else {
            if(curSize == maxSizeCache) {
                List* list = freqListMap[minFreq]; 
                keyNode.erase(list->tail->prev->key); 
                freqListMap[minFreq]->removeNode(list->tail->prev);
                curSize--; 
            }
            curSize++; 
            // new value has to be added who is not there previously 
            minFreq = 1; 
            List* listFreq = new List(); 
            if(freqListMap.find(minFreq) != freqListMap.end()) {
                listFreq = freqListMap[minFreq]; 
            }
            Node* node = new Node(key, value); 
            listFreq->addFront(node);
            keyNode[key] = node; 
            freqListMap[minFreq] = listFreq; 
        }
    }
};

/**
 * Your LFUCache object will be instantiated and called as such:
 * LFUCache* obj = new LFUCache(capacity);
 * int param_1 = obj->get(key);
 * obj->put(key,value);
 */
// BY LONG DIVISION CONCEPT :


package Recursion;
import java.util.Scanner;


public class RecGCDbyEuclidAlgorithm {

     public static int gcd(int x,int y){



          if(y==0) return x;
          return gcd(y,x%y);


     }

     public static void main(String[] args) {

          Scanner sc=new Scanner(System.in);
          System.out.println("Enter x and y: ");
          int x=sc.nextInt();
          int y=sc.nextInt();


          int ans=gcd(x,y);
          System.out.println("gcd of "+x+" and"+y+" is :"+ans);
          sc.close();
     }

}

// WE KNOW THAT  :   lcm(x,y)= (x*y)/gcd(x,y)


package Recursion;
import java.util.Scanner;


public class RecLCM {

     public static int lcm(int x,int y){

          if(y==0) return x;
          return lcm(y,x%y);
     }

     public static void main(String[] args) {

          Scanner sc=new Scanner(System.in);
          System.out.println("Enter x and y: ");
          int x=sc.nextInt();
          int y=sc.nextInt();
          int ans=lcm(x,y);
          System.out.println("LCM of "+x+" and "+y+" is: "+(x*y)/ans);


          sc.close();
     }

}
import random

def guess_the_number():
    number_to_guess = random.randint(1, 100)
    attempts = 0
    while True:
        guess = int(input("Guess the number (1-100): "))
        attempts += 1
        if guess < number_to_guess:
            print("Too low!")
        elif guess > number_to_guess:
            print("Too high!")
        else:
            print(f"Congratulations! You guessed the number in {attempts} attempts.")
            break

guess_the_number()
/* Add .pa-bullet-list-check as class in text module */
.pa-bullet-list-check ul {
list-style-type: none!important;
}
.pa-bullet-list-check ul li:before {
content: '\4e'!important;
color: #787F84;
font-family: 'ETMODULES'!important;
margin-right: 0.5vw;
margin-left: -1vw;
font-size: 1.27vw!important;
}
#include <iostream>
using namespace std;

int main() {
  int arr[10] = {23 , 122 , 41, 67};
  cout << arr << endl;
  cout << &arr[0] << endl;
  cout << *arr << endl; 
  cout << *(arr) << endl; 
  cout << *(arr+1) << endl;
  cout << *(arr) + 4 << endl;
  cout << arr[2] << endl;
  cout << *(arr+2) << endl;
  

  
  
    return 0;
}
#include <iostream>
using namespace std;

int main() {
  int arr[10] = {23 , 122 , 41, 67};

  int n[10];
   cout << sizeof(n) << endl;
   
   int *p = &n[5];
    cout << sizeof(*p) << endl;
    cout << sizeof(p) << endl;
     cout << sizeof(&p) << endl;
  
  

  
  
    return 0;
}
#include <iostream>
using namespace std;

int main() {
  int arr[10] = {23 , 122 , 41, 67};
  cout << arr << endl;
  cout << &arr[0] << endl;
  cout << *arr << endl; 
  cout << *(arr) << endl; 
  cout << *(arr+1) << endl;
  cout << *(arr) + 4 << endl;
  cout << arr[2] << endl;
  cout << *(arr+2) << endl;
  

  
  
    return 0;
}
git remote add origin https://github.com/Code2Buzz/PyTorch.git
git branch -M main
git push -u origin main
echo "# PyTorch" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/Code2Buzz/PyTorch.git
git push -u origin main
#Sort a list without using sort()
def sort_list(nums):
    sorted_list = []
    while nums:
        minimum = min(nums)
        sorted_list.append(minimum)
        nums.remove(minimum)
    return sorted_list

numbers = [5, 3, 8, 2, 7]
sorted_numbers = sort_list(numbers)
print(f"Sorted list: {sorted_numbers}")
numbers = [5, 3, 8, 2, 7]

# Find max and min
max_number = max(numbers)
min_number = min(numbers)

print(f"Max: {max_number}, Min: {min_number}")
grades = {}

# Add student grades
grades["Emily"] = 88
grades["James"] = 76
grades["Olivia"] = 92

# Print all students and their grades
for student, grade in grades.items():
    print(f"{student}: {grade}")
# Create a dictionary - paired values
student_grades = {
    "Alice": 90,
    "Bob": 85,
    "Charlie": 92
}

# Access and modify
print(student_grades["Alice"])
student_grades["Bob"] = 88  # Update Bob's grade

# Add a new entry
student_grades["Dave"] = 95

print(student_grades)
favorite_movies = []

# Add movies
favorite_movies.append("The Godfather")
favorite_movies.append("Pulp Fiction")

# Remove a movie
favorite_movies.remove("Pulp Fiction")

# Print the list
print(f"My favorite movies: {favorite_movies}")
star

Wed Sep 18 2024 14:59:05 GMT+0000 (Coordinated Universal Time)

@usman13

star

Wed Sep 18 2024 14:58:29 GMT+0000 (Coordinated Universal Time)

@usman13

star

Wed Sep 18 2024 14:48:01 GMT+0000 (Coordinated Universal Time)

@usman13

star

Wed Sep 18 2024 14:46:43 GMT+0000 (Coordinated Universal Time)

@usman13

star

Wed Sep 18 2024 14:44:45 GMT+0000 (Coordinated Universal Time)

@usman13

star

Wed Sep 18 2024 14:21:44 GMT+0000 (Coordinated Universal Time)

@dannygelf #apex #flow #salesforce

star

Wed Sep 18 2024 12:26:00 GMT+0000 (Coordinated Universal Time)

@odesign

star

Wed Sep 18 2024 12:04:24 GMT+0000 (Coordinated Universal Time)

@lokan32 #bash #find #sort

star

Wed Sep 18 2024 11:22:54 GMT+0000 (Coordinated Universal Time)

@mdfahadmalik27

star

Wed Sep 18 2024 11:22:53 GMT+0000 (Coordinated Universal Time)

@mdfahadmalik27

star

Wed Sep 18 2024 11:00:27 GMT+0000 (Coordinated Universal Time)

@michaelhaydon

star

Wed Sep 18 2024 09:51:26 GMT+0000 (Coordinated Universal Time)

@chatgpt #kotlin

star

Wed Sep 18 2024 09:47:49 GMT+0000 (Coordinated Universal Time)

@chatgpt #kotlin

star

Wed Sep 18 2024 09:39:59 GMT+0000 (Coordinated Universal Time) https://www.coinsclone.com/top-blockchains-to-launch-nft-marketplace/

@LilianAnderson #nftmarketplacedevelopment #nftblockchain #nftbusinesssolutions #nftsonethereum #nftcreators

star

Wed Sep 18 2024 08:14:07 GMT+0000 (Coordinated Universal Time)

@osama911

star

Wed Sep 18 2024 08:13:39 GMT+0000 (Coordinated Universal Time)

@osama911

star

Wed Sep 18 2024 08:13:07 GMT+0000 (Coordinated Universal Time)

@osama911

star

Wed Sep 18 2024 08:12:34 GMT+0000 (Coordinated Universal Time)

@osama911

star

Wed Sep 18 2024 08:12:07 GMT+0000 (Coordinated Universal Time)

@osama911

star

Wed Sep 18 2024 08:11:28 GMT+0000 (Coordinated Universal Time)

@osama911

star

Wed Sep 18 2024 08:10:54 GMT+0000 (Coordinated Universal Time)

@osama911

star

Wed Sep 18 2024 08:09:55 GMT+0000 (Coordinated Universal Time)

@osama911

star

Wed Sep 18 2024 08:09:15 GMT+0000 (Coordinated Universal Time)

@osama911

star

Wed Sep 18 2024 08:08:42 GMT+0000 (Coordinated Universal Time)

@osama911

star

Wed Sep 18 2024 08:07:52 GMT+0000 (Coordinated Universal Time)

@osama911

star

Wed Sep 18 2024 07:35:45 GMT+0000 (Coordinated Universal Time)

@vasttininess #css

star

Wed Sep 18 2024 05:07:00 GMT+0000 (Coordinated Universal Time)

@hamzahanif192

star

Wed Sep 18 2024 03:59:00 GMT+0000 (Coordinated Universal Time) https://www.linkedin.com/posts/fernandofernandez1_did-you-know-visualforce-still-can-be-activity-7240660560457949184-Vtkh/?utm_source

@WayneChung

star

Wed Sep 18 2024 00:53:37 GMT+0000 (Coordinated Universal Time)

@cedayhoff

star

Wed Sep 18 2024 00:47:48 GMT+0000 (Coordinated Universal Time)

@WXAPAC

star

Tue Sep 17 2024 20:04:02 GMT+0000 (Coordinated Universal Time)

@marcopinero #sql

star

Tue Sep 17 2024 16:06:39 GMT+0000 (Coordinated Universal Time) https://app.clay.com/workspaces/58450/tables/t_ThHPPiXmqxMR/views/gv_gJaXy5bsjyx5

@turadj

star

Tue Sep 17 2024 13:46:25 GMT+0000 (Coordinated Universal Time)

@alexandratech

star

Tue Sep 17 2024 11:13:35 GMT+0000 (Coordinated Universal Time) https://www.roblox.com/ko/users/8645047/profile

@Vitinlonlon73

star

Tue Sep 17 2024 11:01:20 GMT+0000 (Coordinated Universal Time)

@s911dsystems

star

Tue Sep 17 2024 08:01:23 GMT+0000 (Coordinated Universal Time)

@codestored #cpp

star

Mon Sep 16 2024 19:38:49 GMT+0000 (Coordinated Universal Time) https://prathmeshjavaprogram.blogspot.com/2024/09/recursion-questions-4-gcd-euclids.html

@Prathuman

star

Mon Sep 16 2024 19:38:39 GMT+0000 (Coordinated Universal Time) https://prathmeshjavaprogram.blogspot.com/2024/09/recursion-questions-4-gcd-euclids.html

@Prathuman

star

Mon Sep 16 2024 18:35:27 GMT+0000 (Coordinated Universal Time)

@jerseyitguy #python

star

Mon Sep 16 2024 15:40:06 GMT+0000 (Coordinated Universal Time) https://www.peeayecreative.com/change-bullet-lists-into-check-marks-in-divi/

@KaiTheKingRook

star

Mon Sep 16 2024 15:18:58 GMT+0000 (Coordinated Universal Time)

@E23CSEU1151

star

Mon Sep 16 2024 15:17:50 GMT+0000 (Coordinated Universal Time)

@E23CSEU1151

star

Mon Sep 16 2024 15:03:07 GMT+0000 (Coordinated Universal Time)

@E23CSEU1151

star

Mon Sep 16 2024 14:29:32 GMT+0000 (Coordinated Universal Time) https://github.com/Code2Buzz/PyTorch

@Code2Buzz

star

Mon Sep 16 2024 14:28:39 GMT+0000 (Coordinated Universal Time) https://github.com/Code2Buzz/PyTorch

@Code2Buzz

star

Mon Sep 16 2024 13:22:50 GMT+0000 (Coordinated Universal Time)

@jerseyitguy #python

star

Mon Sep 16 2024 13:22:08 GMT+0000 (Coordinated Universal Time)

@jerseyitguy #python

star

Mon Sep 16 2024 13:21:04 GMT+0000 (Coordinated Universal Time)

@jerseyitguy #python

star

Mon Sep 16 2024 13:20:29 GMT+0000 (Coordinated Universal Time)

@jerseyitguy #python

star

Mon Sep 16 2024 13:19:52 GMT+0000 (Coordinated Universal Time)

@jerseyitguy #python

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension