Snippets Collections
add_filter( 'pre_wp_mail', '__return_false' );
setwd("C:\\Users\\d.a.odhiambo\\Desktop\\UBR5 vs Mets Analysis")
# Load TPM data
tpm <- read.csv("GemTPM_Primary.csv")
# Remove duplicate rows from Counts
tpm <- tpm[!duplicated(tpm[, 1]), ]
rownames(tpm) <- tpm[, 1]
tpm <- tpm[, -1]

ubr5_expr <- as.numeric(tpm["UBR5", ])
library(msigdbr)
library(GSVA)
library(dplyr)

# Get Hallmark Interferon Gamma Response gene set
m_df <- msigdbr(species = "Homo sapiens", category = "H")
hallmark_ifng_genes <- m_df %>%
  filter(gs_name == "HALLMARK_INTERFERON_GAMMA_RESPONSE") %>%
  pull(gene_symbol)

# Subset to only genes in your dataset
gene_set_list <- list(HALLMARK_INTERFERON_GAMMA_RESPONSE = intersect(hallmark_ifng_genes, rownames(tpm)))

# Prepare expression matrix (ensure it's numeric)
tpm_matrix <- as.matrix(tpm)
mode(tpm_matrix) <- "numeric"

library(GSVA)

# Step 1: Create ssGSEA parameter object (no additional args here!)
ssgsea_params <- ssgseaParam(exprData = tpm_matrix, geneSets = gene_set_list)

# Step 2: Run ssGSEA
ssgsea_scores <- gsva(param = ssgsea_params)

# Get the Hallmark Interferon Gamma Response score
ifng_score <- as.numeric(ssgsea_scores["HALLMARK_INTERFERON_GAMMA_RESPONSE", ])
cor.test(ubr5_expr, ifng_score)

# Run correlation test
correlation_result <- cor.test(ubr5_expr, ifng_score)

# Get correlation coefficient and p-value
cor_coefficient <- round(correlation_result$estimate, 3)  # Extract correlation coefficient and round
p_value <- round(correlation_result$p.value, 3)  # Extract p-value and round

# Plotting
library(ggplot2)

# Create a data frame for plotting
data_for_plot <- data.frame(
  UBR5_Expression = ubr5_expr,
  IFNG_Score = ifng_score
)

# Generate the plot
ggplot(data_for_plot, aes(x = UBR5_Expression, y = IFNG_Score)) +
  geom_point(color = "blue") +
  labs(title = "Correlation between UBR5 Expression and IFN-gamma Response",
       x = "UBR5 Expression",
       y = "Hallmark IFN-gamma Response Score") +
  theme_minimal() +
  geom_smooth(method = "lm", se = FALSE, color = "red") +  # Adding a linear regression line for visualization
  annotate("text", x = max(ubr5_expr), y = min(ifng_score), 
           label = paste("r = ", cor_coefficient, "\np = ", format(p_value, scientific = TRUE)),  # Use scientific format for very small p-values
           hjust = 1, vjust = 0, color = "black", size = 5, fontface = "italic")
p_value <- formatC(correlation_result$p.value, format = "f", digits = 7)
label = paste("r = ", cor_coefficient, "\np = ", p_value)
# Get correlation coefficient and exact p-value
cor_coefficient <- round(correlation_result$estimate, 3)
p_value <- formatC(correlation_result$p.value, format = "f", digits = 7)

# Create plot
ggplot(data_for_plot, aes(x = UBR5_Expression, y = IFNG_Score)) +
  geom_point(color = "blue") +
  labs(title = "Correlation between UBR5 Expression and IFN-gamma Response",
       x = "UBR5 Expression",
       y = "Hallmark IFN-gamma Response Score") +
  theme_minimal() +
  geom_smooth(method = "lm", se = FALSE, color = "red") +
  annotate("text", x = max(ubr5_expr), y = min(ifng_score),
           label = paste("r = ", cor_coefficient, "\np = ", p_value),
           hjust = 1, vjust = 0, color = "black", size = 5, fontface = "italic")
{% set gl_entries = frappe.db.sql("""
    SELECT posting_date, voucher_no, debit, credit, remarks
    FROM `tabGL Entry`
    WHERE party_type = 'Customer'
    AND party = %s
    AND is_cancelled = 0
    AND posting_date <= %s
    ORDER BY posting_date DESC, creation DESC
    LIMIT 5
""", (doc.customer, doc.posting_date), as_dict=1) %}

{% set gl_totals = frappe.db.sql("""
    SELECT 
        COALESCE(SUM(debit), 0) AS total_debit,
        COALESCE(SUM(credit), 0) AS total_credit
    FROM `tabGL Entry`
    WHERE party_type = 'Customer'
    AND party = %s
    AND is_cancelled = 0
    AND posting_date BETWEEN '2024-01-01' AND %s
""", (doc.customer, doc.posting_date), as_dict=1)[0] %}

<style>
    @media print {
        body {
            margin: 0;
            padding-bottom: 100px; /* Enough room for footer */
        }
    }

    body {
        font-family: Arial, sans-serif;
        font-size: 12px;
        position: relative;
    }

    .invoice-title {
        text-align: center;
        font-size: 24px;
        font-weight: bold;
        margin-bottom: 20px;
        color: #2c3e50;
    }

    .section-title {
        font-size: 16px;
        margin-top: 30px;
        font-weight: bold;
        color: #34495e;
        border-bottom: 1px solid #ccc;
        padding-bottom: 5px;
    }

    .details-box {
        display: flex;
        justify-content: space-between;
        margin-bottom: 20px;
    }

    .details-box div {
        width: 48%;
        line-height: 1.6;
    }

    table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 25px;
    }

    th {
        background-color: #f5f5f5;
        text-align: left;
        padding: 8px;
        border: 1px solid #ddd;
    }

    td {
        padding: 8px;
        border: 1px solid #ddd;
    }

    .balance-box {
        text-align: right;
        font-size: 16px;
        font-weight: bold;
        color: #2d3436;
        margin-top: 20px;
    }

    .small-text {
        font-size: 10px;
        color: #555;
    }

    /* Fixed footer */
    .footer-section {
        position: fixed;
        bottom: 20px;
        left: 0;
        width: 100%;
        font-size: 11px;
        font-family: Arial, sans-serif;
        text-align: center;
        padding: 0 30px;
        color: #000;
    }

    .footer-line {
        border-top: 1px solid #000;
        margin-bottom: 5px;
        width: 100%;
    }

    .footer-labels {
        display: flex;
        justify-content: space-around;
    }

    .created-by {
        text-align: left;
        margin-top: 5px;
    }
</style>

<div class="invoice-title">Sales Invoice</div>

<div class="details-box">
    <div>
        <b>Customer:</b> {{ doc.customer_name }}<br>
        <b>Customer Code:</b> {{ doc.customer }}<br>
        <b>DC No:</b> {{ doc.custom_dc_no or '' }}
    </div>
    <div>
        <b>Invoice No:</b> {{ doc.name }}<br>
        <b>Posting Date:</b> {{ frappe.utils.formatdate(doc.posting_date) }}<br>
        <b>Bilty No:</b> {{ doc.custom_bilty_no or '' }}<br>
        <b>Transporter:</b> {{ doc.custom_transport or '' }}
    </div>
</div>

<div class="section-title">Current Sales Invoice</div>

<table>
    <thead>
        <tr>
            <th>#</th>
            <th>Item</th>
            <th>Qty</th>
            <th>Rate (PKR)</th>
            <th>Amount (PKR)</th>
        </tr>
    </thead>
    <tbody>
        {% set total_amount = 0 %}
        {% for item in doc.items %}
        {% set total_amount = total_amount + (item.amount or 0) %}
        <tr>
            <td>{{ loop.index }}</td>
            <td>{{ item.item_name }}</td>
            <td>{{ item.qty }}</td>
            <td>{{ "{:,.0f}".format(item.rate or 0) }}</td>
            <td>{{ "{:,.0f}".format(item.amount or 0) }}</td>
        </tr>
        {% endfor %}
        <tr>
            <td colspan="4" style="text-align: right;"><b>Total</b></td>
            <td><b>{{ "{:,.0f}".format(doc.total or total_amount) }}</b></td>
        </tr>
    </tbody>
</table>

<div class="section-title">Ledger Entries Last 5 (till {{ frappe.utils.formatdate(doc.posting_date) }})</div>

<table>
    <thead>
        <tr>
            <th>Date</th>
            <th>Voucher No</th>
            <th>Debit (PKR)</th>
            <th>Credit (PKR)</th>
            <th>Remarks</th>
        </tr>
    </thead>
    <tbody>
        {% for entry in gl_entries %}
        <tr>
            <td>{{ frappe.utils.formatdate(entry.posting_date) }}</td>
            <td>{{ entry.voucher_no }}</td>
            <td>{{ "{:,.0f}".format(entry.debit or 0) }}</td>
            <td>{{ "{:,.0f}".format(entry.credit or 0) }}</td>
            <td class="small-text">{{ entry.remarks or 'No Remarks' }}</td>
        </tr>
        {% endfor %}
    </tbody>
</table>

<div class="balance-box">
    Closing Balance: PKR {{ "{:,.0f}".format((gl_totals.total_debit or 0) - (gl_totals.total_credit or 0)) }}
</div>

<!-- FOOTER AT BOTTOM OF PDF PAGE -->
<style>
    html, body {
        height: 100%;
        margin: 0;
        padding: 0;
    }

    .footer-section {
        position: fixed;
        bottom: 0px;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 11px;
        font-family: Arial, sans-serif;
        color: #000;
    }

    .footer-line {
        border-top: 1px solid #000;
        width: 95%;
        margin: 0 auto 4px auto;
    }

    .footer-labels {
        display: flex;
        justify-content: space-around;
        margin: 0 50px;
    }

    .footer-labels div {
        flex: 1;
    }

    .created-by {
        text-align: left;
        margin-left: 50px;
        margin-top: 4px;
        font-size: 10px;
    }
</style>

<div class="footer-section">
    <div class="footer-line"></div>
    <div class="footer-labels">
        <div>Posted By</div>
        <div>Submitted By</div>
        <div>Verified By</div>
    </div>
    <div class="created-by">
        Created by: {{ frappe.db.get_value('User', doc.owner, 'first_name') or "Unknown" }}
    </div>
</div>
setwd("C:\\Users\\d.a.odhiambo\\Desktop\\UBR5 vs Mets Analysis")
# Load TPM data
tpm <- read.csv("GemTPM_Primary.csv")
# Remove duplicate rows from Counts
tpm <- tpm[!duplicated(tpm[, 1]), ]
rownames(tpm) <-tpm[, 1]
tpm<- tpm [, -1]

ubr5_expr <- as.numeric(tpm["UBR5", ])


# Define genes
# Define target gene(s)
target_gene <- "IFNGR1"

# Filter and extract expression
target_expr <- as.numeric(tpm[rownames(tpm) == target_gene, , drop = FALSE])


# Plotting
library(ggplot2)

library(ggrepel)

# Assuming column names of tpm are sample names:
sample_names <- colnames(tpm)

# Create the correlation data frame with sample names
correlation_data <- data.frame(
  Sample = sample_names,
  UBR5 = ubr5_expr,
  IFNGR1 = target_expr
)

# Identify samples with "high" CD274 (you can define your own threshold)
high_IFNGR1_thresh <- quantile(correlation_data$IFNGR1, 0.9, na.rm = TRUE)  # top 10% by default
correlation_data$Label <- ifelse(correlation_data$IFNGR1 > high_IFNGR1_thresh, correlation_data$Sample, "")

# Pearson correlation
cor_test <- cor.test(correlation_data$UBR5, correlation_data$IFNGR1, method = "pearson")
cor_value <- round(cor_test$estimate, 3)
p_value <- signif(cor_test$p.value, 3)


ggplot(correlation_data, aes(x = UBR5, y = IFNGR1)) +
  geom_point(color = "blue", size = 3, alpha = 0.7) +
  geom_smooth(method = "lm", color = "red", se = TRUE) +
  geom_text_repel(aes(label = Label), size = 3, max.overlaps = Inf) +
  labs(
    title = "Correlation between UBR5 and IFNGR1_PT",
    x = "UBR5 Expression",
    y = "IFNGR1 Expression"
  ) +
  theme_minimal() +
  annotate(
    "text",
    x = max(correlation_data$UBR5, na.rm = TRUE) * 0.8,
    y = max(correlation_data$IFNGR1, na.rm = TRUE),
    label = paste("Pearson r =", cor_value, "\nP-value =", p_value),
    size = 5,
    color = "black",
    hjust = 0
  )

       
       




















{% set gl_entries = frappe.db.sql("""
    SELECT posting_date, voucher_no, debit, credit, remarks
    FROM `tabGL Entry`
    WHERE party_type = 'Customer'
    AND party = %s
    AND is_cancelled = 0
    AND posting_date <= %s
    ORDER BY posting_date DESC, creation DESC
    LIMIT 5
""", (doc.customer, doc.posting_date), as_dict=1) %}

{% set gl_totals = frappe.db.sql("""
    SELECT 
        COALESCE(SUM(debit), 0) AS total_debit,
        COALESCE(SUM(credit), 0) AS total_credit
    FROM `tabGL Entry`
    WHERE party_type = 'Customer'
    AND party = %s
    AND is_cancelled = 0
    AND posting_date BETWEEN '2024-01-01' AND %s
""", (doc.customer, doc.posting_date), as_dict=1)[0] %}

<style>
    body {
        font-family: Arial, sans-serif;
        font-size: 12px;
        color: #2c3e50;
    }
    .invoice-title {
        text-align: center;
        font-size: 24px;
        font-weight: bold;
        margin-bottom: 20px;
        color: #2c3e50;
    }
    .section-title {
        font-size: 16px;
        margin-top: 30px;
        font-weight: bold;
        color: #1e3799;
        border-bottom: 2px solid #1e3799;
        padding-bottom: 5px;
    }
    .details-box {
        display: flex;
        justify-content: space-between;
        margin-bottom: 20px;
    }
    .details-box div {
        width: 48%;
        line-height: 1.6;
    }
    table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 25px;
    }
    th {
        background-color: #dff9fb;
        text-align: left;
        padding: 8px;
        border: 1px solid #dcdde1;
    }
    td {
        padding: 8px;
        border: 1px solid #dcdde1;
    }
    .balance-box {
        text-align: right;
        font-size: 16px;
        font-weight: bold;
        color: #2d3436;
        margin-top: 20px;
    }
    .remarks-column {
        font-size: 10px; /* Smaller font size for Remarks column */
    }
</style>

<div class="invoice-title">Sales Invoice</div>

<div class="details-box">
    <div>
        <b>Customer:</b> {{ doc.customer_name }}<br>
        <b>Customer Code:</b> {{ doc.customer }}<br>
        <b>DC No:</b> {{ doc.custom_dc_no or "-" }}
    </div>
    <div>
        <b>Invoice No:</b> {{ doc.name }}<br>
        <b>Posting Date:</b> {{ frappe.utils.formatdate(doc.posting_date, "dd-MM-yyyy") }}<br>
        <b>Bilty No:</b> {{ doc.custom_bilty_no or "-" }}<br>
        <b>Transporter:</b> {{ doc.custom_transport or "-" }}
    </div>
</div>

<div class="section-title">Current Sales Invoice</div>

<table>
    <thead>
        <tr>
            <th>#</th>
            <th>Item</th>
            <th>Qty</th>
            <th>Rate (PKR)</th>
            <th>Amount (PKR)</th>
        </tr>
    </thead>
    <tbody>
        {% for item in doc.items %}
        <tr>
            <td>{{ loop.index }}</td>
            <td>{{ item.item_name }}</td>
            <td>{{ (item.qty or 0) | int }}</td>
            <td>{{ "{:,}".format((item.rate or 0) | int) }}</td>
            <td>{{ "{:,}".format((item.amount or 0) | int) }}</td>
        </tr>
        {% endfor %}
        <tr>
            <td colspan="4" style="text-align: right;"><b>Total</b></td>
            <td><b>{{ "{:,}".format(doc.total | int) }}</b></td>
        </tr>
    </tbody>
</table>

<div class="section-title">Ledger Entries Last 5 (till {{ frappe.utils.formatdate(doc.posting_date, "dd-MM-yyyy") }})</div>

<table>
    <thead>
        <tr>
            <th>Date</th>
            <th>Voucher No</th>
            <th>Debit (PKR)</th>
            <th>Credit (PKR)</th>
            <th>Remarks</th>
        </tr>
    </thead>
    <tbody>
        {% for entry in gl_entries %}
        <tr>
            <td>{{ frappe.utils.formatdate(entry.posting_date, "dd-MM-yyyy") }}</td>
            <td>{{ entry.voucher_no }}</td>
            <td>{{ "{:,}".format((entry.debit or 0) | int) }}</td>
            <td>{{ "{:,}".format((entry.credit or 0) | int) }}</td>
            <td class="remarks-column">{{ entry.remarks or 'No Remarks' }}</td>
        </tr>
        {% endfor %}
    </tbody>
</table>

<div class="balance-box">
    Closing Balance: PKR {{ "{:,}".format(((gl_totals.total_debit or 0) - (gl_totals.total_credit or 0)) | int) }}
</div>
// export const getWorkstation = (workstationId, currentLocale) => {
//   return instance.get(
//     "/api/" + currentLocale + "/workstations/" + workstationId
//   );
// };

// export const createWorkstation = (resource, currentLocale) => {
//   return instance.post("/api/" + currentLocale + "/workstations/", {
//     ...resource
//   });
// };

// export const updateWorkstation = (workstationId, resource, currentLocale) => {
//   return instance.patch(
//     "/api/" + currentLocale + "/workstations/" + workstationId,
//     {
//       ...resource
//     }
//   );
// };
import axios, { AxiosRequestConfig } from "axios";
import Axios from "axios";

const instance = axios.create({
  baseURL: 'http://localhost:5555/',
  timeout: 60000,
});

// const logOut = () => {
//   // Clear user-related data from localStorage/sessionStorage
//   localStorage.removeItem('authToken');
//   localStorage.removeItem('refreshToken');
//   persisterStore.purge(); // Purge persisted Redux store if needed

//   // Optionally dispatch a Redux action to clear user state
//   store.dispatch({ type: 'LOGOUT' });

//   // Redirect to login page or any other route
//   window.location.href = '/login';
// };

export const apiServices = {
  postData: async (requestUrl, payload) => {
    const token = localStorage.getItem("yestoken");
    try {
      const response = await instance.post(`${requestUrl}`, payload, {
        headers: { Authorization: `Bearer ${token}` },
      });
      // if (response.data.message === 'TOKEN IS EXPIRED') {
      //   logOut();
      // }
      return response;
    } catch (error) {
      console.error("Error during POST request:", error);
      return error.response;
    }
  },
  fetchData: async (requestUrl, params) => {
    const token = localStorage.getItem("yestoken");
    try {
      // Perform the GET request
      const response = await instance.get(`${requestUrl}`, {
        params,
        headers: { Authorization: `Bearer ${token}` },
      });
      return response;
    } catch (error) {
      console.error("Error during GET request:", error);
      throw error;
    }
  },
  changeData: async (requestUrl, payload) => {
    const token = localStorage.getItem("yestoken");
    console.warn("()()change-put", token);
    try {
      // Perform the PUT request
      const response = await instance.put(`${requestUrl}`, payload, {
        headers: { Authorization: `Bearer ${token}` },
      });
      return response;
    } catch (error) {
      console.error("Error during PUT request:", error);
      throw error;
    }
  },
  deleteData: async (requestUrl, params) => {
    const token = localStorage.getItem("yestoken");
    console.warn("()()delete-delete", token);
    try {
      const response = await instance.delete(`${requestUrl}`, {
        params,
        headers: { Authorization: `Bearer ${token}` },
      });
      return response;
    } catch (error) {
      console.error("Error during DELETE request:", error);
      throw error;
    }
  },
  deleteDataPayload: async (requestUrl, payload) => {
    const token = localStorage.getItem("yestoken");
    try {
      const response = await Axios.delete(requestUrl, {
        headers: {
          Authorization: `Bearer ${token}`,
        },
        data: payload,
      });
      return response;
    } catch (error) {
      console.error("Error during DELETE request:", error);
      throw error;
    }
  },
  updateData: async (requestUrl, payload) => {
    const token = localStorage.getItem("yestoken");
    console.warn("()()update-patch", token);
    try {
      const response = await instance.patch(`${requestUrl}`, payload, {
        headers: { Authorization: `Bearer ${token}` },
      });
      return response;
    } catch (error) {
      console.error("Error during PATCH request:", error);
      throw error;
    }
  },
};
info "Ticket ID: " + tktid;

// Step 1: Get the Desk ticket
getTicket = zoho.desk.getRecordById("807258170","tickets",tktid);
ticketData = getTicket.get("statusType");

// Step 2: Fetch matching record from Zoho Creator using TKT_Desk_ID
tktresp = invokeurl
[
	url :"https://creatorapp.zoho.com/api/v2/support729/safe-guard/report/All_Service_Requests?criteria=(TKT_Desk_ID==" + tktid + ")"
	type :GET
	connection:"creator"
];
info tktresp;

// Step 3: Extract Creator record ID from the response
if (tktresp.containsKey("data") && tktresp.get("data").size() > 0)
{
    record = tktresp.get("data").get(0);
    recordID = record.get("ID").toLong(); // Ensure it's BIGINT
    info "Record ID to update: " + recordID;

    // Step 4: Prepare and send update
    updateMap = Map();
    optionalMap = Map();
    updateMap.put("Ticket_Status", ticketData);

    updateResp = zoho.creator.updateRecord("support729", "safe-guard", "All_Service_Requests", recordID, updateMap, optionalMap, "creator");
    info "Update response: " + updateResp.toString();
}
else
{
    info "No matching record found in Creator for Desk Ticket ID: " + tktid;
}
void Send_Maill_Update.Desk_Ticket_Post(int Rec_id, string sub, string cont, string to)
{
	Employ_data = Employment_Check[ID == input.Rec_id];
	info to;
	orgId = 60008472224;
	// 	contactId = "39794000001546129";
	contactId = "39794000007712322";
	dataMap = Map();
	dataMap.put("subject",sub);
	dataMap.put("description",cont);
	dataMap.put("departmentId","39794000006446468");
	dataMap.put("contactId",contactId);
	cfMap = Map();
	cfMap.put("cf_creator_id",Employ_data.ID);
	cfMap.put("cf_to_email",to);
	dataMap.put("cf",cfMap);
	response = zoho.desk.create(orgId,"tickets",dataMap,"desk_integration");
	// 	info response;
	ticketId = response.get("id");
	ticketno = response.get("ticketNumber");
	Employ_data.Desk_Mail_Status="Submitted";
	if(Employ_data.cf_zoho_desk_id != null && Employ_data.cf_zoho_desk_id != "")
	{
		Employ_data.cf_zoho_desk_id=Employ_data.cf_zoho_desk_id + "," + ticketId;
		Employ_data.Zoho_Ticket_No=Employ_data.Zoho_Ticket_No + "," + ticketno;
	}
	else
	{
		Employ_data.cf_zoho_desk_id=ticketId;
		Employ_data.Zoho_Ticket_No=ticketno;
	}
}


Post Record in Desk

tickets = invokeurl
	[
		url :"https://desk.zoho.in/api/v1/tickets"
		type :GET
		headers:{"OrgId":"60008472224"}
		connection:"desk"
	];
	ticketId = null;
	for each  potentialTicket in tickets.get("data")
	{
		ticketSubject = potentialTicket.get("subject").trim().toLowerCase();
		ticketLastIndex = ticketSubject.lastIndexOf(" -  - ");
		ticketIdExtracted = if(ticketLastIndex != -1,ticketSubject.subString(ticketLastIndex + 6),"");
		if(ticketIdExtracted == searchId && potentialTicket.get("cf_creator_id") == null)
		{
			ticketId = potentialTicket.get("id");
		}
	}


GET Record from Desk
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
filebrowser -r /path/to/your/files
script_directory=$(dirname "$BASH_SOURCE")
echo "Script directory: $script_directory"
// Product - View More Button
const $products = $('.item-group-slider .slick-slide');

$products.each(function(index){
    let href = $(this).find('.itemTitle a').attr('href');
    $(this).find('.itemDetail').append($(`<a href="${href}" class="cta-btn">View More</a>`));
});
<%{
	get_comp = Company_Details[ID != null];
	imgqr = get_comp.QR_Code;
	qrurl = "https://creator.zohopublic.in/carrierwheels/erp/Company_Details_Report/" + get_comp.ID + "/QR_Code/image-download/j6hYk3Aydznp76py4dSap5JAORMuJxeEjMAb2Vdsteh0Cg35dYySwyzXFY2Fz1KFhjwJttt5ka7nn5jbvnnxGJD1Hh8BeJMJ6qZN/" + imgqr;
	CompanyLogo = "https://carrierwheels.com/images/CW_Logo.png";
	company_stamp = "https://carrierwheels.com/images/Approved_Stamp-CWPL.jpg";
	calstamp = "https://workdrive.zoho.com/file/muo5y868dd7d53ec64985bbf148dd9c50e7df";
	fetcal = Calibration_History[ID == input.ID.tolong()];
	calmast = Calibration_Master[Gauge_No == fetcal.Gauge_No.Gauge_No];
	img_name = ifnull(fetcal.Attachment.getSuffix("image/").getPrefix("border").replaceAll("\"","").trim(),"");
	customrurl = "https://creator.zohopublic.in/carrierwheels/erp/Calibration_History_Report/" + fetcal.ID + "/Attachment/image-download/AzPNXH4sPQ1RzdsMsbg3tu9gabdAw2h9GBK1TPRxd3xPXCEwF1gYjZSSyEzxVVkhPzBWnGj2jwZr5aKKNgm6AFbb4RdJxdmAjJWM/" + img_name;
	%>
<br>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<style>


.table2
   {
   width : 100%;
   border :1px solid black;
   text-align : center;
   border-collapse : collapse;
   font-family: Times New Roman;
   margin-left:auto;
   margin-right:auto;
   }
   html{
    height: 100%;
}
.headtab
{
border : 0;
  margin : 0;
}
@page {
margin: 0;
margin-top : 0;
margin-bottom : 0;
margin-left : 0;
margin-right : 0;
}
@media print {
     body {margin: 0mm}
}
</style>
<table class="table2"  >
 <tr>

  <td rowspan="5" width="10%"><img src=<%=CompanyLogo%>  width="86px" height ="20px"></td>
        
		 <td rowspan="5" style= "font-size : 18px ; font-family : Times New Roman; text-align:center;padding-top : 0px; padding-bottom:0px;border-right: 1px solid black;border-left: 1px solid black;padding-left: 100px;"><h7 style="color:lightblue"><b>CARRIER WHEELS PVT LTD</h7></b><br><b>Calibration Report</b></td>
</tr>
       <tr style="border-collapse:collapse; border :0px solid black;"><td style = "text-align:left; width:10%; border :0px solid black; border-collapse : collapse; font-size:11px;"><b> Doc No :</b> </td> </td><td style = "text-align:left; width:10%; border :0px solid black; border-collapse : collapse; font-size:11px;"><b> CWPL/QA/F/05</b> </td></tr>
	  
		 <tr><td style = "text-align:left; width:10%; border :0px solid black; border-collapse : collapse; font-size:10px;"><b>Rev.no : </b> </td> <td style = "text-align:left; width:10%; border :0px solid black; border-collapse : collapse; font-size:10px;"> <b>03</b></td></tr>
		 <tr><td style = "text-align:left; width:10%; border :0px solid black; border-collapse : collapse; font-size:10px;"><b>Rev.Date : </b></td> <td style = "text-align:left; width:10%; border :0px solid black; border-collapse : collapse; font-size:10px;"><b>01.04.2023 </b></td></tr>
		 <tr><td style = "text-align:left; width:10%; border :0px solid black; border-collapse : collapse; font-size:10px;"><b>Origin.Date :</b> </td> <td style = "text-align:left; width:10%; border :0px solid black; border-collapse : collapse; font-size:10px;"> <b>12.06.2012</b></td></tr>
		 </table>
	 <style>
.supplier
   {
			width: 100%;
			margin-left: auto;
			margin-right: auto;
			border: 1px solid black;
			border-collapse: collapse;
			
   }
   		.prod
	{
		text-align: left;
		font-size : 10.5px;
	   	width : 100%;
	   	height : 0.5px;
		border :1px solid black; 
		border-collapse : collapse;	   
	}
	 .tr
   {
   border :1px solid black;
   border-collapse : collapse;
   font-size : 13px;
   height : 2px;
   }
   .td
   {
   border :1px solid black;
   border-collapse : collapse;
   font-size : 12px;
   height : 2px;
   }
	   .th
   {
   border :1px solid black;
   border-collapse : collapse;
   font-size : 12px;
   height : 2px;
   }
</style>
<table class = "supplier">
<tr>
 <td style="text-align:center; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b> SETUP DETAILS</td></tr>
 </table>
 
 <table class = "supplier">
      <tr><td style="text-align:left; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b> Item Name: </td> <td style="text-align:left; width:20% ;border :1px solid black; border-collapse : collapse;font-size:12px"><%=ifnull(fetcal.Item_Name.Item_Name,"")%>  </td>
		  <td style="text-align:left; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b> Calibration Date: </td> <td style="text-align:left; width:20% ;border :1px solid black; border-collapse : collapse;font-size:12px"><%=ifnull(fetcal.Cal_Done_Date,"")%></td></tr>
		   <tr><td style="text-align:left; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b>Gauge No: </td> <td style="text-align:left; width:20% ;border :1px solid black; border-collapse : collapse;font-size:12px"><%=ifnull(fetcal.Gauge_No.Gauge_No,"")%></td>
		  <td style="text-align:left; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b> Master Instrument: </td> <td tyle="text-align:left; width:20% ;border :1px solid black; border-collapse : collapse;font-size:12px"><%=ifnull(fetcal.Master_Instruments.Item_Name,"")%></td></tr>
			<tr><td style="text-align:left; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b>Location: </td> <td style="text-align:left; width:20% ;border :1px solid black; border-collapse : collapse;font-size:12px"><%=ifnull(fetcal.Location.Location_Name,"")%></td>
		  <td style="text-align:left; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b> Internal /External: </td> <td style="text-align:left; width:20% ;border :1px solid black; border-collapse : collapse;font-size:12px"><%=ifnull(fetcal.Calibration_Type,"")%></td></tr>
		  <tr><td style="text-align:left; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b>Usable Range: </td> <td style="text-align:left; width:20% ;border :1px solid black; border-collapse : collapse;font-size:12px"><%=ifnull(fetcal.Usable_Range.Usable_Range,"")%> </td>
		  <td style="text-align:left; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b>Least Count: </td> <td style="text-align:left; width:20% ;border :1px solid black; border-collapse : collapse;font-size:12px"><%=ifnull(fetcal.Least_Count.Least_Count,"")%></td></tr>
		  <tr><td style="text-align:left; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b>Frequency: </td> <td style="text-align:left; width:20% ;border :1px solid black; border-collapse : collapse;font-size:12px"><%=ifnull(fetcal.Frequency.Frequency,"")%> </td>
		  <td style="text-align:left; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b>Cal Due Date: </td> <td style="text-align:left; width:20% ;border :1px solid black; border-collapse : collapse;font-size:12px"><%=ifnull(calmast.Cal_Due_Date,"")%></td></tr>
</table>
		 <table class = "supplier">
<tr>
 <td style="text-align:center; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b> IMAGE</td></tr>
<tr> <td  style="text-align:center;"><img src=<%=customrurl%> height="130px" width="200px"> </td></tr>

 </table>
 <table class="supplier" >
<tr style="border :1px solid black; border-collapse : collapse;" >
	<td colspan = "3" style="text-align:center;font-size:13px; border :1px solid black; border-collapse : collapse;" > <b>RECORDING <b></td>
</tr>
</table>

<table style="width : 100%; border :1px solid black; border-collapse : collapse; font-size : 10.5px;">
<tr class="tr">
<th class="th" ><b>S.No</th>
<th class="th">Item Name</th>
<th class="th">Description</th>
<th class="th">Specification(Range)	</th>
<th class="th">Actual</th>
<th class="th">Difference</th>
<th class="th">Permissible error</th>
<th class="th" width="60px">Status</th>
<th class="th">Remarks</th>
</tr>
<%
	slno = 1;
	for each  sub in fetcal.Item_Details1
	{
		fet_material = Calibration_Master[Item_Name == sub.Item_Name.Item_Name];
		%>
<tr class="tr">
<td class="td" align = "center"><%=sub.S_No%> </td>
<td class="td" align = "center"><%=ifnull(sub.Item_Name.Item_Name,"")%></td>
<td class="td" align = "center"><%=ifnull(sub.Description,"")%></td>
<td class="td" align = "center"><%=ifnull(sub.Spec_Range,"")%></td>
<td class="td" align = "center"><%=ifnull(sub.Actual,"")%></td>
<td class="td" align = "center"><%=ifnull(sub.Difference,"")%></td>
<td class="td" align = "center"><%=ifnull(sub.Permissable_Error,"")%></td>
<td class="td" align = "center"><%=ifnull(sub.Status,"")%></td>
<td class="td" align = "center"><%=ifnull(sub.Remarks,"")%></td>
<%
	}
	%>
</table>
<table class = "supplier">
<tr>
 <td style="text-align:center; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b>DECISION/RESULTS</td></tr>
 </table>
 <table class = "supplier">
      <tr><td style="text-align:left; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b>Calibration Result: </td> <td style="text-align:left; width:20% ;border :1px solid black; border-collapse : collapse;font-size:12px"><%=ifnull(fetcal.Result,"")%> </td></tr>
	  <tr><td style="text-align:left; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b>Calibration Remarks: </td> <td style="text-align:left; width:20% ;border :1px solid black; border-collapse : collapse;font-size:12px"><%=ifnull(fetcal.Terms_Conditions,"")%></td></tr>
	  </table>
	  
	  <table class = "supplier">
<tr>
 <td style="text-align:center; width:10% ;border :1px solid black; border-collapse : collapse;font-size:13px ;"> <b>VALIDATION TEAM</td></tr>
 </table>
<table style="width : 100%; border :1px solid black; border-collapse : collapse; font-size : 10.5px;">
<tr class="tr">
<th class="th" >&nbsp;&nbsp;&nbsp;</th>
<th class="th">Calibration By:</th>
<th class="th">Verification By:</th>
<th class="th">Approved By:</th>
</tr>
<%
	for each  rec in fetcal
	{
		%>
<tr class="tr">
<td class="td"><b><%="Name"%></td></b>
<td class="td" align = "center"><%=rec.Calibration_By.Employee_Name%></td>
<td class="td" align = "center"><%=rec.Checked_By.Employee_Name%></td>
<td class="td" align = "center"><%=rec.Approved_By.Employee_Name%></td>
</tr>
<tr class="tr">
<td class="td"><b><%="Date"%></td></b>
<td class="td" align = "center"><%=ifnull(fetcal.Cal_Done_Date,"")%></td>
<td class="td" align = "center"><%=ifnull(fetcal.Cal_Done_Date,"")%></td>
<td class="td" align = "center"><%=ifnull(fetcal.Cal_Done_Date,"")%></td>
</tr>
<tr class="tr">
<td class="td"><b><%="Signature"%></td></b>
<td class="td" align = "center"><%=""%></td>
<td class="td" align = "center"><%=""%></td>
<td class="td" align = "center"><%=""%></td>
</tr>
<%
	}
	%>
</table>
<style>
	.table3
	{
		 width : 100%;
	   margin-left: auto;
	   margin-right: auto;
	   font-size : 12px;
	   border :1px solid black;
	   border-collapse :collapse;
	   text-align: center;
	}
</style>
<table class="table3" style="margin-bottom: 50px;">
<tr>
<td><b><img src=<%=company_stamp%> width="100px" height ="50px"  align = "center"><br> QA Department</b></td>
<!--<td><b><img src=<%=qrurl%> height ="70px" align = "center"><br> QR Code</b></td>-->
</tr> 
<tr>
<td style="font-size:11px;text-align:center;height:1px; border-collapse : collapse ; border-top : 1px solid black; border-bottom : 1px solid black; margin-botton: auto;"colspan=4> <p style="font-size : 10px;text-align:center"><b>This is system generated report</b></td></tr>	   
   
</table>
<%

}%>
INSERT INTO team_kingkong.tpap_cybercell_fraud_base3
select upi_txn_id_switch,
    txn_date_switch,
    txn_amount_switch,
    payer_vpa_switch,
    payee_vpa_switch,
    payer_mcc_switch,
    payee_mcc_switch,
    payer_handle,
    payee_handle,
    scope_cust_id,
    merchant_bene_type,
    category,
    payer_mobile_no,
    upi_subtype,
    reporting_date,
    ingestion_date,
    'Cybercell' as source
    from
        (select * from
            (select DISTINCT transaction_id as txnid,
            cast(txn_amount as double) as txn_amount,
            DATE(reporting_date) as reporting_date,
            DATE(dl_last_updated) AS ingestion_date,
            row_number() over(partition by transaction_id) as txn_id_duplicate
            FROM frauds.ppsl_cybercell_snapshot_v3
            where DATE(dl_last_updated) BETWEEN DATE'2025-02-01' AND DATE'2025-02-28'
            and transaction_id NOT IN ('', ' ', 'NA', 'N.A', '0') and transaction_id is not null) 
        where txn_id_duplicate = 1) b
    inner join
        (select distinct json_extract_scalar(payresultcontext, '$.payMethodResultList[0].extendInfo.payeeVpa') AS payee_vpa,
        transactionid,
        IF(rrncode IS NOT NULL, rrncode, banktxnid) as rrn_pg,
        DATE(dl_last_updated) as dl_last_updated
        FROM risk_maquette_data_async.pplus_payment_result_prod_async_snapshot_v3
        Where DATE(dl_last_updated) BETWEEN DATE'2024-12-01' AND DATE'2025-02-28' -- DATE_ADD(CURRENT_DATE, -90)
        and date(gmt_occur_derived) BETWEEN DATE'2024-12-01' AND DATE'2025-02-28' -- DATE_ADD(CURRENT_DATE, -90)
        and payresult in ('payment_success') and upper(paymethod) in ('UPI')) c
    on b.txnid = c.transactionid AND c.dl_last_updated < b.reporting_date
    INNER join
        (SELECT * FROM
            (select DISTINCT b.created_on as txn_date_switch
            ,a.txn_id as upi_txn_id_switch
            , a.vpa as payer_vpa_switch
            , b.vpa as  payee_vpa_switch
            , a.amount as txn_amount_switch
            ,a.mcc as payer_mcc_switch
            , b.mcc as payee_mcc_switch
            ,a.handle as payer_handle
            , b.handle as payee_handle
            ,a.scope_cust_id
            ,a.mobile_no as payer_mobile_no
            ,(case when (lower(b.vpa) like '%@paytm%' or lower(b.vpa) like '%@pt%') then 'paytm merchant/bene' else 'others' end) merchant_bene_type
            from switch.txn_participants_snapshot_v3 a
            inner join switch.txn_participants_snapshot_v3 b on a.txn_id = b.txn_id
            where DATE(a.dl_last_updated) BETWEEN DATE'2024-12-01' AND DATE'2025-02-28' -- DATE_ADD(CURRENT_DATE, -90)
            and b.dl_last_updated BETWEEN DATE'2024-12-01' AND DATE'2025-02-28' -- DATE_ADD(CURRENT_DATE, -90)
            and a.created_on BETWEEN DATE'2024-12-01' AND DATE'2025-02-28' -- DATE_ADD(CURRENT_DATE, -90)
            and a.participant_type in ('PAYER') and b.participant_type in ('PAYEE')
            and (lower(a.vpa) like'%@paytm%' or lower(a.vpa) like '%@pt%')) x
        inner join
            (select DISTINCT txn_id, category, rrn
            from switch.txn_info_snapshot_v3
            where DATE(dl_last_updated) BETWEEN DATE'2024-12-01' AND DATE'2025-02-28' -- DATE_ADD(CURRENT_DATE, -90)
            and DATE(created_on) BETWEEN DATE'2024-12-01' AND DATE'2025-02-28' -- DATE_ADD(CURRENT_DATE, -90)
            and upper(status) in ('SUCCESS')) f
    on x.upi_txn_id_switch = f.txn_id)y
on y.rrn = c.rrn_pg and y.payee_vpa_switch = c.payee_vpa AND y.txn_date_switch < b.reporting_date
LEFT JOIN
    (SELECT DISTINCT txnid
    , regexp_replace(cast(json_extract(request, '$.evaluationType') as varchar), '"', '') AS upi_subtype
    , CAST(json_extract_scalar(request, '$.requestPayload.amount') AS DOUBLE) as amount
    , json_extract_scalar(request, '$.requestPayload.payeeVpa') as payeeVpa
    , DATE(dl_last_updated) as dl_last_updated
    FROM tpap_hss.upi_switchv2_dwh_risk_data_snapshot_v3
    WHERE DATE(dl_last_updated) BETWEEN DATE'2024-12-01' AND DATE'2025-02-28'
    AND json_extract_scalar(response, '$.action_recommended') = 'PASS'
    AND json_extract_scalar(request, '$.source') = 'UPI'
    AND (lower(json_extract_scalar(request, '$.requestPayload.payerVpa')) LIKE '%@paytm%'
    or lower(json_extract_scalar(request, '$.requestPayload.payerVpa')) like '%@pt%'))d
on y.upi_txn_id_switch = d.txnid AND y.txn_amount_switch = d.amount AND c.payee_vpa = d.payeeVpa AND d.dl_last_updated < b.reporting_date
;
CREATE TABLE team_kingkong.tpap_efrm_fraud_base2 AS
select DISTINCT
upi_txn_id_switch,
txn_date_switch,
txn_amount_switch,
payer_vpa_switch,
payee_vpa_switch,
payer_mcc_switch,
payee_mcc_switch,
payer_handle,
payee_handle,
scope_cust_id,
merchant_bene_type,
category,
payer_mobile_no,
upi_subtype,
'NA' AS reporting_date,
ingestion_date,
'EFRM' as source
from
       (select txn_id as upi_txn_id
        , DATE(MIN(dl_last_updated)) AS ingestion_date
        , cast(regexp_replace(txn_amount, ',', '') as double) as txn_amount
        -- , payee_vpa
        from frauds.efrm_data_snapshot_v3
        where dl_last_updated >= DATE'2024-12-01'
        GROUP BY 1,3) a
    inner join
        (select DISTINCT DATE(b.created_on) as txn_date_switch,
        a.txn_id as upi_txn_id_switch
        , a.vpa as payer_vpa_switch
        , b.vpa as  payee_vpa_switch
        , CAST(a.amount AS DOUBLE) as txn_amount_switch
        ,a.mcc as payer_mcc_switch
        , b.mcc as payee_mcc_switch
        ,a.handle as payer_handle
        , b.handle as payee_handle
        ,a.scope_cust_id
        ,a.mobile_no as payer_mobile_no
        ,(case when (lower(b.vpa) like '%@paytm%' or lower(b.vpa) like '%@pt%') then 'paytm merchant/bene' else 'others' end) merchant_bene_type
        from switch.txn_participants_snapshot_v3 a
            inner join
        switch.txn_participants_snapshot_v3 b
        on a.txn_id = b.txn_id
        where DATE(a.dl_last_updated) >= DATE'2024-12-01'
        and DATE(b.dl_last_updated) >= DATE'2024-12-01'
        and DATE(a.created_on) >= DATE'2024-12-01'
        and a.participant_type in ('PAYER')
        and b.participant_type in ('PAYEE')
        and (lower(a.vpa) like'%@paytm%' or lower(a.vpa) like '%@pt%')) c
    on a.upi_txn_id = c.upi_txn_id_switch AND a.txn_amount = c.txn_amount_switch AND C.txn_date_switch < a.ingestion_date
    inner join
        (select DISTINCT txn_id, category, CAST(amount AS DOUBLE) AS amount, DATE(created_on) as created_on
        from switch.txn_info_snapshot_v3
        where dl_last_updated >= DATE'2024-12-01'
        and created_on >= DATE'2024-12-01' 
        and upper(status) in ('SUCCESS')) e
    on a.upi_txn_id = e.txn_id AND a.txn_amount = e.amount AND e.created_on < a.ingestion_date
    LEFT JOIN
        (SELECT DISTINCT txnid
        , regexp_replace(cast(json_extract(request, '$.evaluationType') as varchar), '"', '') AS upi_subtype
        , CAST(json_extract_scalar(request, '$.requestPayload.amount') AS DOUBLE) as amount
        , json_extract_scalar(request, '$.requestPayload.payeeVpa') as payeeVpa
        , DATE(dl_last_updated) as dl_last_updated
        FROM tpap_hss.upi_switchv2_dwh_risk_data_snapshot_v3
        WHERE DATE(dl_last_updated) >= DATE'2024-12-01' 
        AND json_extract_scalar(response, '$.action_recommended') = 'PASS'
        AND json_extract_scalar(request, '$.source') = 'UPI'
        AND (lower(json_extract_scalar(request, '$.requestPayload.payerVpa')) LIKE '%@paytm%'
        or lower(json_extract_scalar(request, '$.requestPayload.payerVpa')) like '%@pt%'))b
    on a.upi_txn_id = b.txnid AND a.txn_amount = b.amount AND b.dl_last_updated < a.ingestion_date
    ;
<style>
  /* Make sure containers never lose their center alignment */
  .container-medium,
  .container-small,
  .container-large {
    margin-right: auto !important;
    margin-left: auto !important;
  }
</style>
[ExtensionOf(formControlStr(InventQualityOrderTable, InventQualityOrderReopen))]
public final class InventQualityOrderTable_InventQualityOrderReopen_CPL_Extension
{
  void clicked()
  {
    FormFunctionButtonControl InventQualityOrderReopen = this;
    FormRun formRun = InventQualityOrderReopen.formRun(); 
    FormDataSource inventQualityOrderTable_ds = formRun.dataSource(formDataSourceStr(InventQualityOrderTable,InventQualityOrderTable));
    InventQualityOrderTable inventQualityOrderTable = inventQualityOrderTable_ds.cursor();
    FormDataSource inventQualityOrderLine_ds = formRun.dataSource(formDataSourceStr(InventQualityOrderTable,InventQualityOrderLine));

    try
    {
      next clicked();
    }
    catch(Exception::Error)
    {
      infolog.clear();

      inventQualityOrderLine_ds.allowEdit(inventQualityOrderTable.OrderStatus == InventTestOrderStatus::Open);
  
      //<PMF>
      if (#PdsShelfEnabled
            && inventQualityOrderTable.inventBatchId())
      {
        PdsUpdateDispositionStatus_Quality::newQuality(
                inventQualityOrderTable).run();
      }
      inventQualityOrderTable_ds.reread();
      inventQualityOrderTable_ds.refresh();
      inventQualityOrderTable_ds.active();
    }
  }

}
{
	"blocks": [
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":sunshine: :x-connect: Boost Days: What's on this week :x-connect: :sunshine:"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Good morning Brisbane, \n\n Please see below for what's on this week! "
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-28: Monday, 28th April",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n:coffee: *Café Partnership*: Enjoy free coffee and café-style beverages from our Cafe partner *Edwards*.\n\n :Lunch: *Lunch*: provided in the kitchen from *12pm* in the kitchen.\n\n:massage:*Wellbeing*: Pilates at *SP Brisbane City* is bookable every Monday!"
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-30: Wednesday, 30th Aprill",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": ":coffee: *Café Partnership*: Enjoy free coffee and café-style beverages from our Cafe partner *Edwards*. \n\n:lunch: *Morning Tea*: provided by _Say Cheese_ from *9am* in the kitchen!"
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-2:Friday, 2nd April ",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": ":cheers-9743: *Happy Hour:* from 3pm - 4pm in the kitchen! Wind down for the week over some drinks and nibbles."
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Stay tuned to this channel for more details, check out the <https://calendar.google.com/calendar/u/0?cid=Y19uY2M4cDN1NDRsdTdhczE0MDhvYjZhNnRjb0Bncm91cC5jYWxlbmRhci5nb29nbGUuY29t|*Brisbane Social Calendar*>, and get ready to Boost your workdays!\n\nLove,\nWX Team :party-wx:"
			}
		}
	]
}
{
	"blocks": [
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":sunshine: Boost Days - What's On This Week :sunshine:"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n\n Good morning Sydney,\n\n Hope you all had a relaxing long weekend! Please see what's on for the week below."
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": "Xero Café Partnership :coffee:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n :coffee: Head to *Naked Duck* for your free coffee on Wednesday & Thursday"
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": " Wednesday, 30th April :calendar-date-12:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": " \n\n :Roadshow: *Tableau Roadshow*: From 9am in the Breakout Space. \n\n :Breakfast: *Breakfast*: Provided by *Naked Duck* from *9am* in the the Kitchen . \n\n :lunch: *Light Lunch*: Provided by *Naked Duck* from *12pm* in the the Kitchen."
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": "Thursday, 1st May :calendar-date-13:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n :lunch:  *Lunch* from 12.00pm in the Kitchen. \n\n:Drink: Social Hour from 4pm-5pm in breakpout space "
			}
		},
		{
			"type": "divider"
		}
	]
}
{
	"blocks": [
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":xeros-connect: Boost Days - What's on this week! :xeros-connect:"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "Morning Ahuriri :wave: Happy Monday, let's get ready to dive into another week in the Hawke's Bay office! See below for what's in store :eyes:"
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-30: Wednesday, 30th April :camel:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n:coffee: *Café Partnership*: Enjoy coffee and café-style beverages from our cafe partner, *Adoro*, located in our office building *8:00AM - 11:30AM*.\n:breakfast: *Breakfast*: Provided by *Design Cuisine* from *9:30AM-10:30AM* in the Kitchen."
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":calendar-date-1: Thursday, 1st May :may:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n:coffee: *Café Partnership*: Enjoy coffee and café-style beverages from our cafe partner, *Adoro*, located in our office building *8:00AM - 11:30AM*.\n:wrap: *Lunch*: Provided by *Roam* from *12:30PM-1:30PM* in the Kitchen."
			}
		},
		{
			"type": "divider"
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n *What else?* Stay tuned to this channel for more details, check out the <https://calendar.google.com/calendar/u/0?cid=eGVyby5jb21fbXRhc2ZucThjaTl1b3BpY284dXN0OWlhdDRAZ3JvdXAuY2FsZW5kYXIuZ29vZ2xlLmNvbQ|*Hawkes Bay Social Calendar*>, and get ready to Boost your workdays!\n\nWX Team :party-wx:"
			}
		}
	]
}
Curious about how crypto exchanges generate revenue? It’s not just about trading fees! Successful exchanges make money through withdrawal fees, deposit charges, listing fees for new tokens, margin trading, staking programs, and premium memberships. Some even earn from offering white-label solutions and advertising space!

If you’re planning to launch your own exchange, understanding these income streams is crucial for long-term success.

👉 Ready to create a revenue-driven platform?
Partner with Troniex Technologies – Experts in Crypto Exchange Development and build a secure, scalable exchange packed with the latest monetization features!

Don’t just wonder—take action and turn the booming crypto market into your next big business opportunity.

📈 Contact us today to start your journey toward owning a profitable crypto exchange!
# sudo -s -H
# apt-get clean
# rm /var/lib/apt/lists/*
# rm /var/lib/apt/lists/partial/*
# apt-get clean
# apt-get update
sudo gpg --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg --dearmor oracle_vbox_2016.asc
deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian <mydist> contrib
class Solution {
private:
    int calculateArea(int left, int right, vector<int>& height){
        return (right - left) * min(height[left], height[right]);
    }

public:
    int trap(vector<int>& height) {
        int totalArea = 0;

        if(height.size() <= 2)
            return 0;

        int left = 0, right = 0;

        while(height[left] == 0){
            ++left;

            if(left == height.size()-2)
                break;
        }
        right = left+2;

        while(left < right && right <= height.size()-1){
            totalArea += calculateArea(left, right, height);

            left = right;
            right = left+2;
        }

        return totalArea;
    }
};
#include <stdio.h>
#include <string.h>
#include <stdbool.h>

bool is_valid_string(const char *s) {
    int count_a = 0; // To count the number of 'a's
    int count_b = 0; // To count the number of 'b's
    
    // We need to first check that the string has no other characters than 'a' and 'b'
    // and that all 'a's appear before any 'b'.
    bool found_b = false; // Flag to check if we've started encountering 'b's
    
    for (int i = 0; s[i] != '\0'; i++) {
        if (s[i] == 'a') {
            if (found_b) {
                return false; // If 'b' is encountered before 'a', invalid string
            }
            count_a++;
        }
        else if (s[i] == 'b') {
            found_b = true;
            count_b++;
        }
        else {
            return false; // If any character other than 'a' or 'b', invalid string
        }
    }
    
    // For the string to be valid, the number of 'a's must be equal to the number of 'b's
    return count_a == count_b;
}

int main() {
    char input[100];  // Array to hold user input (up to 99 characters)

    // Prompt the user for input
    printf("Enter a string (only 'a' and 'b' characters are allowed): ");
    scanf("%s", input);

    // Check and print the result
    if (is_valid_string(input)) {
        printf("The string '%s' is valid (a^n b^n).\n", input);
    } else {
        printf("The string '%s' is invalid.\n", input);
    }
    
    return 0;
}



#include <stdio.h>
#include <string.h>

int isValidString(char *str) {
    int count_a = 0, count_b = 0;
    int state = 0; // q0

    printf("\nTransition Table\n");
    printf("Current State | Input | Next State\n");
    printf("-------------------------------\n");

    for (int i = 0; str[i] != '\0'; i++) {
        char ch = str[i];

        printf("q%d | %c | ", state, ch);

        if (state == 0) {
            if (ch == 'a') {
                count_a++;
                printf("q0\n");
            } else if (ch == 'b') {
                state = 1;
                count_b++;
                printf("q1\n");
            } else {
                printf("Reject (Invalid character)\n");
                return 0;
            }
        } else if (state == 1) {
            if (ch == 'b') {
                count_b++;
                printf("q1\n");
            } else if (ch == 'a') {
                printf("Reject (a after b)\n");
                return 0;
            } else {
                printf("Reject (Invalid character)\n");
                return 0;
            }
        }
    }

    // Final validation
    if (state == 1 && count_a == count_b && count_a > 0) {
        printf("\nThe string is valid (a^n b^n)\n");
        return 1;
    } else {
        printf("\nThe string is invalid (a^n b^n)\n");
        return 0;
    }
}

int main() {
    char input[100];
    printf("Enter the string: ");
    scanf("%99s", input); // Prevent buffer overflow
    isValidString(input);
    return 0;
}




#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdbool.h>

bool is_identifier(const char *token) {
    if (!isalpha(token[0]) && token[0] != '_')
        return false;
    for (int i = 1; token[i] != '\0'; i++) {
        if (!isalnum(token[i]) && token[i] != '_')
            return false;
    }
    return true;
}

bool is_constant(const char *token) {
    int i = 0, dot_count = 0;
    if (token[i] == '-' || token[i] == '+') i++;

    if (token[i] == '\0') return false;

    for (; token[i] != '\0'; i++) {
        if (token[i] == '.') {
            if (++dot_count > 1) return false;
        } else if (!isdigit(token[i])) {
            return false;
        }
    }
    return true;
}

bool is_operator(const char *token) {
    const char *operators[] = {"+", "-", "*", "/", "=", "==", "!=", "<", ">", "<=", ">="};
    for (int i = 0; i < sizeof(operators) / sizeof(operators[0]); i++) {
        if (strcmp(token, operators[i]) == 0)
            return true;
    }
    return false;
}

int main() {
    char token[100];
    printf("Enter a token: ");
    scanf("%s", token);

    if (is_operator(token))
        printf("Operator\n");
    else if (is_constant(token))
        printf("Constant\n");
    else if (is_identifier(token))
        printf("Identifier\n");
    else
        printf("Unknown\n");

    return 0;
}



#include <stdio.h>
#include <ctype.h>
#include <string.h>

char keywords[10][10] = {"int", "float", "char", "if", "else", "while", "do", "return", "for", "void"};

int isKeyword(char *word) {
    for (int i = 0; i < 10; i++) {
        if (strcmp(keywords[i], word) == 0)
            return 1;
    }
    return 0;
}

void lexer(char *code) {
    int i = 0;
    char ch, buffer[20];
    int bufferIndex = 0;

    while ((ch = code[i++]) != '\0') {
        if (isalnum(ch)) {
            buffer[bufferIndex++] = ch;
        } else {
            if (bufferIndex != 0) {
                buffer[bufferIndex] = '\0';
                bufferIndex = 0;

                if (isKeyword(buffer))
                    printf("[KEYWORD => %s]\n", buffer);
                else if (isdigit(buffer[0]))
                    printf("[NUMBER => %s]\n", buffer);
                else
                    printf("[IDENTIFIER => %s]\n", buffer);
            }

            if (ch == ' ' || ch == '\n' || ch == '\t')
                continue;

            if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '=')
                printf("[OPERATOR => %c]\n", ch);

            if (ch == '(' || ch == ')' || ch == ';' || ch == '{' || ch == '}')
                printf("[SEPARATOR => %c]\n", ch);
        }
    }
}

int main() {
    char code[1000];
    printf("Enter code (e.g., int a = 10;):\n");
    fgets(code, sizeof(code), stdin);

    printf("\n--- Lexical Tokens ---\n");
    lexer(code);
    return 0;
}



#include <stdio.h>
#include <string.h>

char prod[2][10] = { "S->aA", "A->b" };
char nonTerminals[2][10] = { "S", "A" };
char terminals[3][10] = { "a", "b", "$" };

char table[3][4][15]; // 3 rows (S, A + header), 4 columns (a, b, $, + header)

int getRow(char nt) {
    switch (nt) {
        case 'S': return 1;
        case 'A': return 2;
    }
    return 0;
}

int getCol(char t) {
    switch (t) {
        case 'a': return 1;
        case 'b': return 2;
        case '$': return 3;
    }
    return 0;
}

int main() {
    // Initialize table with empty strings
    for (int i = 0; i < 3; i++)
        for (int j = 0; j < 4; j++)
            strcpy(table[i][j], " ");

    // Fill headers
    strcpy(table[0][0], " ");
    strcpy(table[0][1], "a");
    strcpy(table[0][2], "b");
    strcpy(table[0][3], "$");

    strcpy(table[1][0], "S");
    strcpy(table[2][0], "A");

    // Fill table using FIRST sets
    strcpy(table[getRow('S')][getCol('a')], "S->aA");
    strcpy(table[getRow('A')][getCol('b')], "A->b");

    // Print the table
    printf("Predictive Parsing Table:\n");
    printf("-----------------------------------------\n");

    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 4; j++) {
            printf("%-12s", table[i][j]);
        }
        printf("\n-----------------------------------------\n");
    }

    return 0;
}




#include <stdio.h>
#define SUCCESS 1
#define FAILED 0

const char *cursor;
char input[64];

int E(), Edash(), T(), Tdash(), F();

int main() {
    printf("Enter the string: ");
    scanf("%s", input);
    cursor = input;

    printf("\nInput Action\n");
    printf("-------------------------------\n");

    if (E() && *cursor == '\0') {
        printf("-------------------------------\n");
        printf("String is successfully parsed\n");
    } else {
        printf("-------------------------------\n");
        printf("Error in parsing String\n");
    }
    return 0;
}

int E() {
    printf("%-15s E -> T E'\n", cursor);
    return T() && Edash();
}

int Edash() {
    if (*cursor == '+') {
        printf("%-15s E' -> + T E'\n", cursor);
        cursor++;
        return T() && Edash();
    }
    printf("%-15s E' -> ε\n", cursor);
    return SUCCESS;
}

int T() {
    printf("%-15s T -> F T'\n", cursor);
    return F() && Tdash();
}

int Tdash() {
    if (*cursor == '*') {
        printf("%-15s T' -> * F T'\n", cursor);
        cursor++;
        return F() && Tdash();
    }
    printf("%-15s T' -> ε\n", cursor);
    return SUCCESS;
}

int F() {
    if (*cursor == '(') {
        printf("%-15s F -> ( E )\n", cursor);
        cursor++;
        if (E() && *cursor == ')') {
            cursor++;
            return SUCCESS;
        }
        return FAILED;
    } else if (*cursor == 'i') {
        printf("%-15s F -> i\n", cursor);
        cursor++;
        return SUCCESS;
    }
    return FAILED;
}





#include <stdio.h>
#include <string.h>

int tempVar = 1;

void newTemp(char *temp) {
    sprintf(temp, "t%d", tempVar++);
}
void replace(char expr[][10], int *n, int i, char *temp) {
    strcpy(expr[i - 1], temp);
    for (int j = i + 2; j < *n; j++)
        strcpy(expr[j - 2], expr[j]);
    *n -= 2;
}
void generateTAC(char input[]) {
    char lhs[10], rhs[100];
    int n = 0;
    // Split into lhs and rhs
    sscanf(input, "%[^=]=%s", lhs, rhs);
    char expr[50][10], temp[10];
    // Tokenize RHS
    for (int i = 0; rhs[i]; i++) {
        char t[2] = {rhs[i], '\0'};
        strcpy(expr[n++], t);
    }
    // First handle * and /
    for (int i = 0; i < n; i++)
        if (!strcmp(expr[i], "*") || !strcmp(expr[i], "/")) {
            newTemp(temp);
            printf("%s = %s %s %s\n", temp, expr[i - 1], expr[i], expr[i + 1]);
            replace(expr, &n, i, temp);
            i = -1;
        }
    // Then handle + and -
    for (int i = 0; i < n; i++)
        if (!strcmp(expr[i], "+") || !strcmp(expr[i], "-")) {
            newTemp(temp);
            printf("%s = %s %s %s\n", temp, expr[i - 1], expr[i], expr[i + 1]);
            replace(expr, &n, i, temp);
            i = -1;
        }
    // Final assignment
    printf("%s = %s\n", lhs, expr[0]);
}
int main() {
    char expr[100];
    printf("Enter expression (e.g., a=b+c*d): ");
    scanf("%s", expr);
    generateTAC(expr);
    return 0;
}





#include <stdio.h>
#include <string.h>
 
char prol[7][10] = { "S", "A", "A", "B", "B", "C", "C" };
char pror[7][10] = { "A", "Bb", "Cd", "aB", "@", "Cc", "@" };
char prod[7][10] = { "S->A", "A->Bb", "A->Cd", "B->aB", "B->@", "C->Cc", "C->@" };
char first[7][10] = { "abcd", "ab", "cd", "a@", "@", "c@", "@" };
char follow[7][10] = { "$", "$", "$", "a$", "b$", "c$", "d$" };
char table[5][6][10];
 
int numr(char c)
{
   switch (c)
   {
      case 'S':
         return 0;
 
      case 'A':
         return 1;
 
      case 'B':
         return 2;
 
      case 'C':
         return 3;
 
      case 'a':
         return 0;
 
      case 'b':
         return 1;
 
      case 'c':
         return 2;
 
      case 'd':
         return 3;
 
      case '$':
         return 4;
   }
 
   return (2);
}
 
int main()
{
   int i, j, k;
 
   for (i = 0; i < 5; i++)
      for (j = 0; j < 6; j++)
         strcpy(table[i][j], " ");
 
   printf("The following grammar is used for Parsing Table:\n");
 
   for (i = 0; i < 7; i++)
      printf("%s\n", prod[i]);
 
   printf("\nPredictive parsing table:\n");
 
   fflush(stdin);
 
   for (i = 0; i < 7; i++)
   {
      k = strlen(first[i]);
      for (j = 0; j < 10; j++)
         if (first[i][j] != '@')
            strcpy(table[numr(prol[i][0]) + 1][numr(first[i][j]) + 1], prod[i]);
   }
 
   for (i = 0; i < 7; i++)
   {
      if (strlen(pror[i]) == 1)
      {
         if (pror[i][0] == '@')
         {
            k = strlen(follow[i]);
            for (j = 0; j < k; j++)
               strcpy(table[numr(prol[i][0]) + 1][numr(follow[i][j]) + 1], prod[i]);
         }
      }
   }
 
   strcpy(table[0][0], " ");
 
   strcpy(table[0][1], "a");
 
   strcpy(table[0][2], "b");
 
   strcpy(table[0][3], "c");
 
   strcpy(table[0][4], "d");
 
   strcpy(table[0][5], "$");
 
   strcpy(table[1][0], "S");
 
   strcpy(table[2][0], "A");
 
   strcpy(table[3][0], "B");
 
   strcpy(table[4][0], "C");
 
   printf("\n--------------------------------------------------------\n");
 
   for (i = 0; i < 5; i++)
      for (j = 0; j < 6; j++)
      {
         printf("%-10s", table[i][j]);
         if (j == 5)
            printf("\n--------------------------------------------------------\n");
      }
}



#include <stdio.h>
#include <string.h>

#define NUM_NON_TERMINALS 5
#define NUM_TERMINALS 6
#define MAX_PRODUCTIONS 8
#define MAX_STRING_LENGTH 15

// Grammar productions
char prod[MAX_PRODUCTIONS][MAX_STRING_LENGTH] = { 
    "E->TE'", 
    "E'->+TE'", 
    "E'->@", 
    "T->FT'", 
    "T'->*FT'", 
    "T'->@", 
    "F->(E)", 
    "F->id" 
};

// Non-terminals and terminals
char nonTerminals[NUM_NON_TERMINALS][MAX_STRING_LENGTH] = { "E", "E'", "T", "T'", "F" };
char terminals[NUM_TERMINALS][MAX_STRING_LENGTH] = { "id", "+", "*", "(", ")", "$" };

// First and Follow sets
char first[MAX_PRODUCTIONS][MAX_STRING_LENGTH] = { "id(", "+", "@", "id(", "*", "@", "(", "id" };
char follow[NUM_NON_TERMINALS][MAX_STRING_LENGTH] = { "$)", "$)", "+$)", "+$)", "+*)$" };

// Parsing table
char table[NUM_NON_TERMINALS + 1][NUM_TERMINALS + 1][MAX_STRING_LENGTH];

int getRow(char c) {
    switch (c) {
        case 'E': return 1;
        case 'e': return 2; // treating E' as e
        case 'T': return 3;
        case 't': return 4; // T' as t
        case 'F': return 5;
        default: return 0;
    }
}

int getCol(char *sym) {
    for (int i = 0; i < NUM_TERMINALS; i++) {
        if (strcmp(terminals[i], sym) == 0)
            return i + 1;
    }
    return 0;
}

void fillParsingTable() {
    // Initialize table with empty strings
    for (int i = 0; i <= NUM_NON_TERMINALS; i++) {
        for (int j = 0; j <= NUM_TERMINALS; j++) {
            strcpy(table[i][j], "");
        }
    }

    // Header row
    strcpy(table[0][0], " ");
    for (int i = 0; i < NUM_TERMINALS; i++)
        strcpy(table[0][i + 1], terminals[i]);

    // Left column (non-terminals)
    for (int i = 0; i < NUM_NON_TERMINALS; i++)
        strcpy(table[i + 1][0], nonTerminals[i]);

    // Fill productions in the table
    for (int i = 0; i < MAX_PRODUCTIONS; i++) {
        char nt = prod[i][0];  // Non-terminal in production
        int row = getRow(nt);

        // Iterate through the first set of the production
        for (int j = 0; j < strlen(first[i]); j++) {
            char ch = first[i][j];
            if (ch == '@') {
                // Epsilon production, fill the table using the Follow set
                for (int k = 0; k < strlen(follow[row - 1]); k++) {
                    char fch = follow[row - 1][k];
                    char sym[2] = { fch, '\0' };
                    int col = getCol(sym);
                    if (strcmp(table[row][col], "") == 0)  // If cell is empty, fill it
                        strcpy(table[row][col], prod[i]);
                }
            } else {
                char sym[3] = { ch, '\0', '\0' };  // Increase size to 3 to hold 'i' and 'd' for "id"
                if (ch == 'i') strcpy(sym, "id"); // map 'i' to "id"
                int col = getCol(sym);
                if (strcmp(table[row][col], "") == 0)  // If cell is empty, fill it
                    strcpy(table[row][col], prod[i]);
            }
        }
    }
}

void printTable() {
    printf("-------------------------------------------------------------\n");
    printf("            id          +           *           (           )           $           \n");
    printf("-------------------------------------------------------------\n");

    for (int i = 0; i <= NUM_NON_TERMINALS; i++) {
        for (int j = 0; j <= NUM_TERMINALS; j++) {
            if (strcmp(table[i][j], "") != 0)  // Only print non-empty cells
                printf("%-12s", table[i][j]);
            else
                printf("%-12s", " ");  // Print space for empty cells
        }
        printf("\n-------------------------------------------------------------\n");
    }
}

int main() {
    fillParsingTable();
    printTable();

    return 0;
}


import numpy as np

class Pin:
    def __init__(self, id, n_ring, radius):
        self.id = id
        self.n_ring = n_ring
        self.radius = np.array(radius)

    def calc_total_area(self):
        return np.sum(np.pi * self.radius ** 2)

    def calc_total_volume(self):
        return np.sum((4 / 3) * np.pi * self.radius ** 3)

    def print(self):
        print(f"Pin ID: {self.id}, Rings: {self.n_ring}")
        print(f"Total Area: {self.calc_total_area()}")
        print(f"Total Volume: {self.calc_total_volume()}")

if __name__ == "__main__":
    rad = [1.0, 2.0]
    p = Pin(1, 2, rad)
    p.print()
MODULE Pin_mod
    IMPLICIT NONE
    TYPE :: Pin_type
        INTEGER :: id
        INTEGER :: n_ring
        REAL, ALLOCATABLE :: radius(:)
    END TYPE Pin_type

CONTAINS

    SUBROUTINE init_pin(p, id, n_ring, rad)
        TYPE(Pin_type), INTENT(OUT) :: p
        INTEGER, INTENT(IN) :: id, n_ring
        REAL, INTENT(IN) :: rad(:)

        p%id = id
        p%n_ring = n_ring
        ALLOCATE(p%radius(n_ring))
        p%radius = rad(1:n_ring)
    END SUBROUTINE init_pin

    FUNCTION calc_total_area(p) RESULT(area)
        TYPE(Pin_type), INTENT(IN) :: p
        REAL :: area
        INTEGER :: i

        area = 0.0
        DO i = 1, p%n_ring
            area = area + 3.14159265 * p%radius(i)**2
        END DO
    END FUNCTION calc_total_area

    FUNCTION calc_total_volume(p) RESULT(volume)
        TYPE(Pin_type), INTENT(IN) :: p
        REAL :: volume
        INTEGER :: i

        volume = 0.0
        DO i = 1, p%n_ring
            volume = volume + (4.0 / 3.0) * 3.14159265 * p%radius(i)**3
        END DO
    END FUNCTION calc_total_volume

    SUBROUTINE print_pin(p)
        TYPE(Pin_type), INTENT(IN) :: p
        PRINT *, 'Pin ID: ', p%id, ', Rings: ', p%n_ring
        PRINT *, 'Total Area: ', calc_total_area(p)
        PRINT *, 'Total Volume: ', calc_total_volume(p)
    END SUBROUTINE print_pin

    SUBROUTINE free_pin(p)
        TYPE(Pin_type), INTENT(INOUT) :: p
        DEALLOCATE(p%radius)
    END SUBROUTINE free_pin

END MODULE Pin_mod

PROGRAM main
    USE Pin_mod
    TYPE(Pin_type) :: p
    REAL :: rad(2) = [1.0, 2.0]

    CALL init_pin(p, 1, 2, rad)
    CALL print_pin(p)
    CALL free_pin(p)
END PROGRAM main
#include <iostream>
#include <cmath>

class Pin {
public:
    int id;
    int n_ring;
    float* radius;

    Pin(int id, int n_ring, float* rad) : id(id), n_ring(n_ring) {
        radius = new float[n_ring];
        for (int i = 0; i < n_ring; i++) {
            radius[i] = rad[i];
        }
    }

    ~Pin() {
        delete[] radius;
    }

    float calc_total_area() {
        float area = 0.0;
        for (int i = 0; i < n_ring; i++) {
            area += M_PI * radius[i] * radius[i];
        }
        return area;
    }

    float calc_total_volume() {
        float volume = 0.0;
        for (int i = 0; i < n_ring; i++) {
            volume += (4.0 / 3.0) * M_PI * radius[i] * radius[i] * radius[i];
        }
        return volume;
    }

    void print() {
        std::cout << "Pin ID: " << id << ", Rings: " << n_ring << "\n";
        std::cout << "Total Area: " << calc_total_area() << "\n";
        std::cout << "Total Volume: " << calc_total_volume() << "\n";
    }
};

int main() {
    float rad[] = {1.0, 2.0};
    Pin p(1, 2, rad);
    p.print();
    return 0;
}
CREATE TABLE team_kingkong.tpap_cybercell_fraud_base2 AS
select upi_txn_id_switch,
    txn_date_switch,
    txn_amount_switch,
    payer_vpa_switch,
    payee_vpa_switch,
    payer_mcc_switch,
    payee_mcc_switch,
    payer_handle,
    payee_handle,
    scope_cust_id,
    merchant_bene_type,
    category,
    payer_mobile_no,
    upi_subtype,
    reporting_date,
    ingestion_date,
    'Cybercell' as source
    from
        (select * from
            (select DISTINCT transaction_id as txnid,
            cast(txn_amount as double) as txn_amount,
            DATE(reporting_date) as reporting_date,
            DATE(dl_last_updated) AS ingestion_date,
            row_number() over(partition by transaction_id) as txn_id_duplicate
            FROM frauds.ppsl_cybercell_snapshot_v3
            where DATE(dl_last_updated) >= DATE'2024-12-01'
            and transaction_id NOT IN ('', ' ', 'NA', 'N.A', '0') and transaction_id is not null) 
        where txn_id_duplicate = 1) b
    inner join
        (select distinct json_extract_scalar(payresultcontext, '$.payMethodResultList[0].extendInfo.payeeVpa') AS payee_vpa,
        transactionid,
        IF(rrncode IS NOT NULL, rrncode, banktxnid) as rrn_pg
        FROM risk_maquette_data_async.pplus_payment_result_prod_async_snapshot_v3
        Where DATE(dl_last_updated) >= DATE'2024-12-01' -- DATE_ADD(CURRENT_DATE, -90)
        and date(gmt_occur_derived) >= DATE'2024-12-01' -- DATE_ADD(CURRENT_DATE, -90)
        and payresult in ('payment_success') and upper(paymethod) in ('UPI')) c
    on b.txnid = c.transactionid
    INNER join
        (
            SELECT * FROM
            (select DISTINCT b.created_on as txn_date_switch
            ,a.txn_id as upi_txn_id_switch
            , a.vpa as payer_vpa_switch
            , b.vpa as  payee_vpa_switch
            , a.amount as txn_amount_switch
            ,a.mcc as payer_mcc_switch
            , b.mcc as payee_mcc_switch
            ,a.handle as payer_handle
            , b.handle as payee_handle
            ,a.scope_cust_id
            ,a.mobile_no as payer_mobile_no
            ,(case when (lower(b.vpa) like '%@paytm%' or lower(b.vpa) like '%@pt%') then 'paytm merchant/bene' else 'others' end) merchant_bene_type
        from switch.txn_participants_snapshot_v3 a
        inner join switch.txn_participants_snapshot_v3 b on a.txn_id = b.txn_id
        where DATE(a.dl_last_updated) >= DATE'2024-12-01' -- DATE_ADD(CURRENT_DATE, -90)
        and b.dl_last_updated >= DATE'2024-12-01' -- DATE_ADD(CURRENT_DATE, -90)
        and a.created_on >= DATE'2024-12-01' -- DATE_ADD(CURRENT_DATE, -90)
        and a.participant_type in ('PAYER') and b.participant_type in ('PAYEE')
        and (lower(a.vpa) like'%@paytm%' or lower(a.vpa) like '%@pt%')) x
    inner join
        (select DISTINCT txn_id, category, rrn
        from switch.txn_info_snapshot_v3
        where DATE(dl_last_updated) >= DATE'2024-12-01' -- DATE_ADD(CURRENT_DATE, -90)
        and DATE(created_on) >= DATE'2024-12-01' -- DATE_ADD(CURRENT_DATE, -90)
        and upper(status) in ('SUCCESS')) f
    on x.upi_txn_id_switch = f.txn_id
    )y
on y.rrn = c.rrn_pg and y.payee_vpa_switch = c.payee_vpa
LEFT JOIN
    (SELECT DISTINCT txnid
    , regexp_replace(cast(json_extract(request, '$.evaluationType') as varchar), '"', '') AS upi_subtype
    , CAST(json_extract_scalar(request, '$.requestPayload.amount') AS DOUBLE) as amount
    , json_extract_scalar(request, '$.requestPayload.payeeVpa') as payeeVpa
    FROM tpap_hss.upi_switchv2_dwh_risk_data_snapshot_v3
    WHERE DATE(dl_last_updated) >= DATE'2024-12-01' 
    AND json_extract_scalar(response, '$.action_recommended') = 'PASS'
    AND json_extract_scalar(request, '$.source') = 'UPI'
    AND (lower(json_extract_scalar(request, '$.requestPayload.payerVpa')) LIKE '%@paytm%'
    or lower(json_extract_scalar(request, '$.requestPayload.payerVpa')) like '%@pt%'))d
on y.upi_txn_id_switch = d.txnid AND y.txn_amount_switch = d.amount AND c.payee_vpa = d.payeeVpa
;
CREATE TABLE team_kingkong.tpap_cybercell_fraud_base2 AS
select upi_txn_id_switch,
    txn_date_switch,
    txn_amount_switch,
    payer_vpa_switch,
    payee_vpa_switch,
    payer_mcc_switch,
    payee_mcc_switch,
    payer_handle,
    payee_handle,
    scope_cust_id,
    merchant_bene_type,
    category,
    payer_mobile_no,
    upi_subtype,
    reporting_date,
    ingestion_date,
    'Cybercell' as source
    from
        (select * from
            (select DISTINCT transaction_id as txnid,
            cast(txn_amount as double) as txn_amount,
            DATE(reporting_date) as reporting_date,
            DATE(dl_last_updated) AS ingestion_date,
            row_number() over(partition by transaction_id) as txn_id_duplicate
            FROM frauds.ppsl_cybercell_snapshot_v3
            where DATE(dl_last_updated) >= DATE'2024-12-01'
            and transaction_id NOT IN ('', ' ', 'NA', 'N.A', '0') and transaction_id is not null) 
        where txn_id_duplicate = 1) b
    inner join
        (select distinct json_extract_scalar(payresultcontext, '$.payMethodResultList[0].extendInfo.payeeVpa') AS payee_vpa,
        transactionid,
        IF(rrncode IS NOT NULL, rrncode, banktxnid) as rrn_pg
        FROM risk_maquette_data_async.pplus_payment_result_prod_async_snapshot_v3
        Where DATE(dl_last_updated) >= DATE'2024-12-01' -- DATE_ADD(CURRENT_DATE, -90)
        and date(gmt_occur_derived) >= DATE'2024-12-01' -- DATE_ADD(CURRENT_DATE, -90)
        and payresult in ('payment_success') and upper(paymethod) in ('UPI')) c
    on b.txnid = c.transactionid
    INNER join
        (
            SELECT * FROM
            (select DISTINCT b.created_on as txn_date_switch
            ,a.txn_id as upi_txn_id_switch
            , a.vpa as payer_vpa_switch
            , b.vpa as  payee_vpa_switch
            , a.amount as txn_amount_switch
            ,a.mcc as payer_mcc_switch
            , b.mcc as payee_mcc_switch
            ,a.handle as payer_handle
            , b.handle as payee_handle
            ,a.scope_cust_id
            ,a.mobile_no as payer_mobile_no
            ,(case when (lower(b.vpa) like '%@paytm%' or lower(b.vpa) like '%@pt%') then 'paytm merchant/bene' else 'others' end) merchant_bene_type
        from switch.txn_participants_snapshot_v3 a
        inner join switch.txn_participants_snapshot_v3 b on a.txn_id = b.txn_id
        where DATE(a.dl_last_updated) >= DATE'2024-12-01' -- DATE_ADD(CURRENT_DATE, -90)
        and b.dl_last_updated >= DATE'2024-12-01' -- DATE_ADD(CURRENT_DATE, -90)
        and a.created_on >= DATE'2024-12-01' -- DATE_ADD(CURRENT_DATE, -90)
        and a.participant_type in ('PAYER') and b.participant_type in ('PAYEE')
        and (lower(a.vpa) like'%@paytm%' or lower(a.vpa) like '%@pt%')) x
    inner join
        (select DISTINCT txn_id, category, rrn
        from switch.txn_info_snapshot_v3
        where DATE(dl_last_updated) >= DATE'2024-12-01' -- DATE_ADD(CURRENT_DATE, -90)
        and DATE(created_on) >= DATE'2024-12-01' -- DATE_ADD(CURRENT_DATE, -90)
        and upper(status) in ('SUCCESS')) f
    on x.upi_txn_id_switch = f.txn_id
    )y
on y.rrn = c.rrn_pg and y.payee_vpa_switch = c.payee_vpa
LEFT JOIN
    (SELECT DISTINCT txnid
    , regexp_replace(cast(json_extract(request, '$.evaluationType') as varchar), '"', '') AS upi_subtype
    , CAST(json_extract_scalar(request, '$.requestPayload.amount') AS DOUBLE) as amount
    , json_extract_scalar(request, '$.requestPayload.payeeVpa') as payeeVpa
    FROM tpap_hss.upi_switchv2_dwh_risk_data_snapshot_v3
    WHERE DATE(dl_last_updated) >= DATE'2024-12-01' 
    AND json_extract_scalar(response, '$.action_recommended') = 'PASS'
    AND json_extract_scalar(request, '$.source') = 'UPI'
    AND (lower(json_extract_scalar(request, '$.requestPayload.payerVpa')) LIKE '%@paytm%'
    or lower(json_extract_scalar(request, '$.requestPayload.payerVpa')) like '%@pt%'))d
on y.upi_txn_id_switch = d.txnid AND y.txn_amount_switch = d.amount AND c.payee_vpa = d.payeeVpa
;
CREATE TABLE team_kingkong.tpap_efrm_fraud_base AS
select DISTINCT
upi_txn_id_switch,
txn_date_switch,
txn_amount_switch,
payer_vpa_switch,
payee_vpa_switch,
payer_mcc_switch,
payee_mcc_switch,
payer_handle,
payee_handle,
scope_cust_id,
merchant_bene_type,
category,
payer_mobile_no,
upi_subtype,
'NA' AS reporting_date,
ingestion_date,
'EFRM' as source
from
       (select txn_id as upi_txn_id
        , DATE(MIN(dl_last_updated)) AS ingestion_date
        , cast(regexp_replace(txn_amount, ',', '') as double) as txn_amount
        -- , payee_vpa
        from frauds.efrm_data_snapshot_v3
        where dl_last_updated >= DATE'2024-12-01'
        GROUP BY 1,3) a
    inner join
        (select DISTINCT DATE(b.created_on) as txn_date_switch,
        a.txn_id as upi_txn_id_switch
        , a.vpa as payer_vpa_switch
        , b.vpa as  payee_vpa_switch
        , CAST(a.amount AS DOUBLE) as txn_amount_switch
        ,a.mcc as payer_mcc_switch
        , b.mcc as payee_mcc_switch
        ,a.handle as payer_handle
        , b.handle as payee_handle
        ,a.scope_cust_id
        ,a.mobile_no as payer_mobile_no
        ,(case when (lower(b.vpa) like '%@paytm%' or lower(b.vpa) like '%@pt%') then 'paytm merchant/bene' else 'others' end) merchant_bene_type
        from switch.txn_participants_snapshot_v3 a
            inner join
        switch.txn_participants_snapshot_v3 b
        on a.txn_id = b.txn_id
        where DATE(a.dl_last_updated) >= DATE'2024-12-01'
        and DATE(b.dl_last_updated) >= DATE'2024-12-01'
        and DATE(a.created_on) >= DATE'2024-12-01'
        and a.participant_type in ('PAYER')
        and b.participant_type in ('PAYEE')
        and (lower(a.vpa) like'%@paytm%' or lower(a.vpa) like '%@pt%')) c
    on a.upi_txn_id = c.upi_txn_id_switch AND a.txn_amount = c.txn_amount_switch --AND a.payee_vpa = c.payee_vpa_switch
    inner join
        (select DISTINCT txn_id, category, CAST(amount AS DOUBLE) AS amount
        from switch.txn_info_snapshot_v3
        where dl_last_updated >= DATE'2024-12-01'
        and created_on >= DATE'2024-12-01' 
        and upper(status) in ('SUCCESS')) e
    on a.upi_txn_id = e.txn_id AND a.txn_amount = e.amount
    LEFT JOIN
        (SELECT DISTINCT txnid
        , regexp_replace(cast(json_extract(request, '$.evaluationType') as varchar), '"', '') AS upi_subtype
        , CAST(json_extract_scalar(request, '$.requestPayload.amount') AS DOUBLE) as amount
        , json_extract_scalar(request, '$.requestPayload.payeeVpa') as payeeVpa
        FROM tpap_hss.upi_switchv2_dwh_risk_data_snapshot_v3
        WHERE DATE(dl_last_updated) >= DATE'2024-12-01' 
        AND json_extract_scalar(response, '$.action_recommended') = 'PASS'
        AND json_extract_scalar(request, '$.source') = 'UPI'
        AND (lower(json_extract_scalar(request, '$.requestPayload.payerVpa')) LIKE '%@paytm%'
        or lower(json_extract_scalar(request, '$.requestPayload.payerVpa')) like '%@pt%'))b
    on a.upi_txn_id = b.txnid AND a.txn_amount = b.amount --AND a.payee_vpa = b.payeeVpa
    ;
{
	"blocks": [
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": ":sunshine: Boost Days - What's On This Week :sunshine:"
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "\n\n Good morning Melbourne,\n\n Hope you all had a relaxing long weekend! Please see what's on for the week below."
			}
		},
		{
			"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 some delicious sweet treats from Via Porta Bakehouse:* \n\n :raspberry: Raspberry & Burnt Financier :cookie:Raisin & Oat Cookies \n\n :milo: *Weekly Café Special:* _Milo Mocha_"
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": " Wednesday, 30th April :calendar-date-12:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": " \n\n :lunch: *Light Lunch*: Provided by *Kartel Catering* from *12pm* in the L3 Kitchen & Wominjeka Breakout Space."
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": "Thursday, 1st May :calendar-date-13:",
				"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 :roadshow: *Tableau Roadshow* from 9am in the Fitzgerald Training Room and the Wominjeka Breakout Space!\n :lunch: *Light Lunch* from 12.30pm in the L3 Kitchen & Wominjeka Breakout Space. \n\n "
			}
		},
		{
			"type": "header",
			"text": {
				"type": "plain_text",
				"text": "Friday, 2nd May :calendar-date-2:",
				"emoji": true
			}
		},
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "*Social Happy Hour* from 4pm-5.30pm :pizza: :friday_yayday::wine_glass:  "
			}
		},
		{
			"type": "divider"
		}
	]
}
<style>

.elementor-field-type-upload.elementor-field-group.elementor-column.elementor-field-group-file_upload.elementor-col-100 label.elementor-field-label{
    color: #505050;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}


	.elementor-field-type-upload.elementor-field-group.elementor-column.elementor-field-group-file_upload.elementor-col-100 label.elementor-field-label:after{
    content: url(https://wordpress-1405257-5222437.cloudwaysapps.com/wp-content/uploads/2025/02/clapboard-upload-1.png);
}


/* Styling for the upload area */
.elementor-field-type-upload {
    border: 1px dashed #69727d;
    padding: 10px 20px !important;
    text-align: center;
    background-color: #F4F7FF;
    cursor: pointer;
    border-radius: 10px;
    margin: 5px;
}

.elementor-field-type-upload:hover {
    background-color: #79c14f24;
}

.elementor-field-type-upload input[type="file"] {
    display: none;
}


/* Styling for the uploaded files grid */
.uploaded-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); /* Ensure multiple columns */
    gap: 10px;
    margin-top: 20px;
    border-radius: 10PX;
    width: 100%; /* Ensure the grid takes up full width of its container */
}

/* Ensures that individual items in the grid are aligned correctly */
.uploaded-file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    position: relative;
}


/* Styling for the file icons */
.uploaded-file-item img {
    width: 50px;
    height: 50px;
    margin-bottom: 10px;
    object-fit: cover;
}

/* Limit text under file to two lines */
.uploaded-file-item span {
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80px;
    display: block;
    text-align: center;
}

/* Button to delete a file */
.delete-file-btn {
    height: 20px !important;
    width: 20px !important;
    padding: 0;
    color: white;
    background: #ef0d0d;
    border-radius: 100px;
    border: none;
		line-height: 0;
    position: relative;
		right: -70px;
    top: -18px;
}



/* Styling for the progress wrapper */
.progress-wrapper {
    width: 100%;
    margin-top: 10px;
}

/* Styling for the success icon */
.success-icon {
    width: 30px;
    height: 30px;
    max-width: 30px;
    max-height: 30px;
    margin-top: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    object-fit: contain!important;
    opacity: 0;  /* Initially hidden */
}

/* Styling for the progress wrapper */
.progress-wrapper {
    width: 100%;
    margin-top: 10px;
}

/* Styling for the progress bar */
progress {
    width: 100%;
    height: 10px;
    border-radius: 5px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
}

/* Optional: styling for the progress bar when it's filling */
progress::-webkit-progress-bar {
    background-color: #f0f0f0;
}

progress::-webkit-progress-value {
    background-color: #14A2DD;
}

</style>


<script>
document.addEventListener('DOMContentLoaded', function() {
  // Global array to store all selected files
  let allFiles = [];
  // Global array to track file names that have been displayed in the UI
  let displayedFiles = [];

  // Initialize the upload area and file input field
  const uploadArea = document.querySelector('.elementor-field-type-upload');
  const fileInput = document.querySelector('#form-field-file_upload');
  const fileList = document.createElement('div');
  fileList.classList.add('uploaded-files-grid');
  // uploadArea.appendChild(fileList);

  // Drag and drop event listeners
  uploadArea.addEventListener('dragover', (e) => {
    e.preventDefault();
    uploadArea.style.backgroundColor = '#79c14f24';
  });
  uploadArea.addEventListener('dragleave', () => {
    uploadArea.style.backgroundColor = '#f9f9f9';
  });
  uploadArea.addEventListener('drop', (e) => {
    e.preventDefault();
    uploadArea.style.backgroundColor = '#f9f9f9';
    handleFiles(e.dataTransfer.files);
  });

  // Input change event listener
  fileInput.addEventListener('change', () => {
    handleFiles(fileInput.files);
  });

  // Function to handle files from both input and drop events
  function handleFiles(files) {
    const newFiles = Array.from(files);
    const filesToUpload = newFiles.filter(file => {
      return !allFiles.some(existingFile => existingFile.name === file.name);
    });

    // If there are new files and fileList is not already appended, then append it
    if (filesToUpload.length > 0 && !uploadArea.contains(fileList)) {
      uploadArea.appendChild(fileList);
    }

    // Continue processing the files (update global array, update UI, etc.)
    allFiles = allFiles.concat(filesToUpload);

    const dataTransfer = new DataTransfer();
    allFiles.forEach(file => dataTransfer.items.add(file));
    fileInput.files = dataTransfer.files;

    filesToUpload.forEach(file => {
      if (displayedFiles.includes(file.name)) return;
      displayedFiles.push(file.name);

      const fileItem = document.createElement('div');
      fileItem.classList.add('uploaded-file-item');

      const deleteBtn = document.createElement('button');
      deleteBtn.textContent = '×';
      deleteBtn.classList.add('delete-file-btn');
      deleteBtn.onclick = () => {
        removeFile(file, fileItem);
      };
      fileItem.appendChild(deleteBtn);

      const fileIcon = document.createElement('img');
      fileIcon.src = getFileIcon(file);
      fileItem.appendChild(fileIcon);

      const fileName = document.createElement('span');
      fileName.textContent = file.name;
      fileItem.appendChild(fileName);

      const progressWrapper = document.createElement('div');
      progressWrapper.classList.add('progress-wrapper');

      const progressBar = document.createElement('progress');
      progressBar.value = 0;
      progressBar.max = 100;
      progressWrapper.appendChild(progressBar);

      fileItem.appendChild(progressWrapper);

      simulateFileUpload(file, progressBar, fileItem, progressWrapper);

      fileList.appendChild(fileItem);
    });
		uploadArea.style.border = "1px dashed #14A2DD";
  }
	
  function simulateFileUpload(file, progressBar, fileItem, progressWrapper) {
    let uploaded = 0;
    const uploadSpeed = Math.random() * 20 + 10;
    const interval = setInterval(() => {
      uploaded += 2;
      progressBar.value = uploaded;
      if (uploaded >= 100) {
        clearInterval(interval);
        showSuccessIcon(fileItem, progressWrapper);
      }
    }, uploadSpeed);
  }

  function showSuccessIcon(fileItem, progressWrapper) {
    const successIcon = document.createElement('img');
    successIcon.src = 'https://img.icons8.com/color/50/000000/checked.png';
    successIcon.classList.add('success-icon');
    progressWrapper.style.display = 'none';
    fileItem.appendChild(successIcon);
    successIcon.style.opacity = 0;
    setTimeout(() => {
      successIcon.style.transition = 'opacity 0.5s';
      successIcon.style.opacity = 1;
    }, 10);
  }

  function getFileIcon(file) {
    if (file.type.includes('pdf')) {
      return 'https://img.icons8.com/color/50/000000/pdf.png';
    } else if (file.type.includes('word')) {
      return 'https://img.icons8.com/color/50/000000/word.png';
    } else if (file.name.toLowerCase().endsWith('.mp4') || file.name.toLowerCase().endsWith('.mov') || file.name.toLowerCase().endsWith('.avi')) {
      return 'https://img.icons8.com/color/50/000000/video.png';
    } else if (file.name.toLowerCase().endsWith('.wav')) {
      return 'https://img.icons8.com/color/50/000000/video.png';
    } else if (file.name.toLowerCase().endsWith('.xls') || file.name.toLowerCase().endsWith('.xlsx') || file.name.toLowerCase().endsWith('.csv')) {
      return 'https://img.icons8.com/color/50/000000/ms-excel.png';
    } else if (file.type.includes('image')) {
      return URL.createObjectURL(file);
    } else {
      return 'https://img.icons8.com/color/50/000000/file.png';
    }
  }

  function removeFile(file, fileItem) {
    // Remove file from the global array
    allFiles = allFiles.filter(f => f.name !== file.name);
    displayedFiles = displayedFiles.filter(name => name !== file.name);

    // Update the file input accordingly
    const dataTransfer = new DataTransfer();
    allFiles.forEach(f => dataTransfer.items.add(f));
    fileInput.files = dataTransfer.files;

    // Remove the file element from the UI
    fileItem.remove();

    // If fileList is empty, remove it from the DOM
    if (fileList.children.length === 0 && uploadArea.contains(fileList)) {
      uploadArea.removeChild(fileList);
    }
		if (allFiles.length === 0) {
    uploadArea.style.border = "1px dashed #ccc";
		}
  }
});


</script>
const fs = require('fs');

// Create a folder named "myFolder"
if (!fs.existsSync('myFolder')) {
  fs.mkdirSync('myFolder');
  console.log('Folder created');
}

// Create a text file
fs.writeFileSync('myFolder/file.txt', 'Hello from Node.js!');

// Create a JSON file
const data = {
  name: 'John',
  age: 25
};
fs.writeFileSync('myFolder/data.json', JSON.stringify(data));

console.log('Files created!');

5d


const fs = require('fs');

// Create a file with some data
fs.writeFileSync('input.txt', 'This is streaming data example.');

// Read from input.txt and write to output.txt using streams
const readStream = fs.createReadStream('input.txt');
const writeStream = fs.createWriteStream('output.txt');

readStream.pipe(writeStream);

console.log('Streaming done!');
src/
├── App.js
├── components/
│   ├── UserList.js
│   ├── AddUser.js
│   ├── EditUser.js
└── services/
    └── api.js

import axios from "axios";

export default axios.create({
  baseURL: "http://localhost:5000/api/users" // adjust to your backend
});


#install
npx create-react-app user-management
cd user-management
npm install axios react-router-dom

#app.js

import React from 'react';
import { BrowserRouter as Router, Routes, Route, Link } from 'react-router-dom';
import UserList from './components/UserList';
import AddUser from './components/AddUser';
import EditUser from './components/EditUser';

function App() {
  return (
    <Router>
      <nav>
        <Link to="/">Users</Link> | <Link to="/add">Add User</Link>
      </nav>
      <Routes>
        <Route path="/" element={<UserList />} />
        <Route path="/add" element={<AddUser />} />
        <Route path="/edit/:id" element={<EditUser />} />
      </Routes>
    </Router>
  );
}

export default App;

userList.js

import React, { useEffect, useState } from 'react';
import axios from '../services/api';
import { Link } from 'react-router-dom';

function UserList() {
  const [users, setUsers] = useState({});

  useEffect(() => {
    axios.get('/').then((res) => {
      setUsers(res.data || {});
    });
  }, []);

  const deleteUser = (id) => {
    axios.delete(`/${id}`).then(() => {
      const updated = { ...users };
      delete updated[id];
      setUsers(updated);
    });
  };

  return (
    <div>
      <h2>Users</h2>
      {Object.entries(users).map(([id, user]) => (
        <div key={id}>
          <p>{user.name} - {user.email}</p>
          <Link to={`/edit/${id}`}>Edit</Link>
          <button onClick={() => deleteUser(id)}>Delete</button>
        </div>
      ))}
    </div>
  );
}

export default UserList;

#AddUser.js

import React, { useState } from 'react';
import axios from '../services/api';
import { useNavigate } from 'react-router-dom';

function AddUser() {
  const [user, setUser] = useState({ name: '', email: '' });
  const navigate = useNavigate();

  const handleChange = (e) => {
    setUser({ ...user, [e.target.name]: e.target.value });
  };

  const addUser = () => {
    axios.post('/', user).then(() => {
      navigate('/');
    });
  };

  return (
    <div>
      <h2>Add User</h2>
      <input name="name" value={user.name} onChange={handleChange} placeholder="Name" />
      <input name="email" value={user.email} onChange={handleChange} placeholder="Email" />
      <button onClick={addUser}>Add</button>
    </div>
  );
}

export default AddUser;

#EditUser.js

import React, { useEffect, useState } from 'react';
import { useParams, useNavigate } from 'react-router-dom';
import axios from '../services/api';

function EditUser() {
  const { id } = useParams();
  const [user, setUser] = useState({ name: '', email: '' });
  const navigate = useNavigate();

  useEffect(() => {
    axios.get(`/${id}`).then((res) => {
      setUser(res.data);
    });
  }, [id]);

  const updateUser = () => {
    axios.put(`/${id}`, user).then(() => {
      navigate('/');
    });
  };

  const handleChange = (e) => {
    setUser({ ...user, [e.target.name]: e.target.value });
  };

  return (
    <div>
      <h2>Edit User</h2>
      <input name="name" value={user.name} onChange={handleChange} />
      <input name="email" value={user.email} onChange={handleChange} />
      <button onClick={updateUser}>Update</button>
    </div>
  );
}

export default EditUser;

#install
npm install
npm start
#install

npm install react-router-dom
npm start


#app.js

import React from 'react';
import { BrowserRouter as Router, Routes, Route, Link } from 'react-router-dom';
import Home from './Home';
import About from './About';
import Contact from './Contact';

function App() {
  const user = "Alice";

  return (
    <Router>
      <div>
        <h1>React Routing Example</h1>
        <nav>
          <Link to="/">Home</Link> |{" "}
          <Link to="/about">About</Link> |{" "}
          <Link to="/contact">Contact</Link>
        </nav>

        <Routes>
          <Route path="/" element={<Home user={user} />} />
          <Route path="/about" element={<About />} />
          <Route path="/contact" element={<Contact email="alice@example.com" />} />
        </Routes>
      </div>
    </Router>
  );
}

export default App;

#home.js
import React from 'react';

function Home({ user }) {
  return (
    <div>
      <h2>Home</h2>
      <p>Welcome, {user}!</p>
    </div>
  );
}

export default Home;

#about.js

import React from 'react';

function About() {
  return (
    <div>
      <h2>About</h2>
      <p>This app demonstrates React Router for navigation.</p>
    </div>
  );
}

export default About;

#contact.js

import React from 'react';

function Contact({ email }) {
  return (
    <div>
      <h2>Contact</h2>
      <p>Contact us at: {email}</p>
    </div>
  );
}

export default Contact;
#app.js

import React, { useState } from 'react';
import Home from './Home';
import About from './About';
import Contact from './Contact';

function App() {
  const [userName, setUserName] = useState("Alice");

  return (
    <div>
      <h1>Welcome to My React App</h1>
      <Home name={userName} />
      <About />
      <Contact email="alice@example.com" />
    </div>
  );
}

export default App;

#home.js

import React from 'react';

function Home(props) {
  return (
    <div>
      <h2>Home</h2>
      <p>Hello, {props.name}! Welcome to the Home page.</p>
    </div>
  );
}

export default Home;

#About.js

import React from 'react';

function About() {
  return (
    <div>
      <h2>About</h2>
      <p>This is a sample React application using components, props, and state.</p>
    </div>
  );
}

export default About;

#contact.js
import React, { useState } from 'react';

function Contact(props) {
  const [message, setMessage] = useState("");

  const handleInput = (e) => {
    setMessage(e.target.value);
  };

  return (
    <div>
      <h2>Contact</h2>
      <p>Email us at: {props.email}</p>
      <input type="text" placeholder="Your message" value={message} onChange={handleInput} />
      <p>Your message: {message}</p>
    </div>
  );
}

export default Contact;
#install
npx create-react-app task13
cd task13


#App.js

// App.js
import React from 'react';
import FunctionalComponent from './FunctionalComponent';
import ClassComponent from './ClassComponent';

function App() {
  return (
    <div>
      <h1>Task 13a: React Functional and Class Components</h1>
      <FunctionalComponent />
      <ClassComponent />
    </div>
  );
}

export default App;

#Class Component

// ClassComponent.js
import React, { Component } from 'react';

class ClassComponent extends Component {
  constructor() {
    super();
    this.state = { count: 0 };
  }

  componentDidMount() {
    console.log('Component Mounted');
  }

  componentDidUpdate() {
    console.log('Component Updated');
  }

  componentWillUnmount() {
    console.log('Component Will Unmount');
  }

  render() {
    return (
      <div>
        <h2>Class Component</h2>
        <p>Count: {this.state.count}</p>
        <button onClick={() => this.setState({ count: this.state.count + 1 })}>
          Increase
        </button>
      </div>
    );
  }
}

export default ClassComponent;

#fc

// FunctionalComponent.js
import React, { useState, useEffect } from 'react';

function FunctionalComponent() {
  const [count, setCount] = useState(0);

  useEffect(() => {
    console.log('Component mounted or updated');

    return () => {
      console.log('Component unmounted');
    };
  }, [count]);

  return (
    <div>
      <h2>Functional Component</h2>
      <p>Count: {count}</p>
      <button onClick={() => setCount(count + 1)}>Increase</button>
    </div>
  );
}

export default FunctionalComponent;
SELECT a.Email__c
FROM (
        SELECT b.Email__c
        FROM [EP_Event_List_for_Upload_to_CRMi] b
        WHERE 1 = 1
        AND LOWER(
            RIGHT (
                b.Email__c,
                LEN(b.Email__c) - CHARINDEX('@', b.Email__c)
            )
        ) IN (
            SELECT LOWER(x.Domain)
            FROM ent.[Dealer Domains] x
    )
) a
 
UNION ALL
SELECT a.Email__c
FROM (
    SELECT b.Email__c
    FROM [EP_Event_List_for_Upload_to_CRMi] b
    WHERE 1 = 1
    AND LOWER(
        RIGHT (
            b.Email__c,
            LEN(b.Email__c) - CHARINDEX('@', b.Email__c)
            )
        ) IN (
            SELECT LOWER(x.Domain)
            FROM ent.[Cat_Agency_Domains] x
    )
) a
 
UNION ALL
SELECT a.Email__c
FROM (
    SELECT b.Email__c
    FROM [EP_Event_List_for_Upload_to_CRMi] b
    WHERE 1 = 1
    AND LOWER(
        RIGHT (
            b.Email__c,
            LEN(b.Email__c) - CHARINDEX('@', b.Email__c)
            )
        ) IN (
            SELECT LOWER(x.Domain)
            FROM ent.[Competitor Domains] x
    )
) a
npm install express body-parser dotenv firebase
void SalesOrder.SO_Acknowledgment_Whatsapp(int soid)
{
	//soid = 143536000022873024;
	info soid;
	salesdetails = Sales_Order[ID == soid];
	//mobileno = Customers[ID == salesdetails.Customer_Name].Phone_Number1;
	getsoack = Sales_Order_Acknowledgement[Sales_Order_No == soid] sort by ID desc;
	mobileno = getsoack.Phone_No;
	grandtotal = 0;
	if(salesdetails.count() > 0 && salesdetails.Sales_Type == "Direct Order")
	{
		grandtotal = ifnull(salesdetails.Grand_Total.round(2),"");
		somap = Map();
		somap.put("sonumber",ifnull(salesdetails.Sale_Order_No,""));
		somap.put("sodate",ifnull(salesdetails.Sale_Order_Date,""));
		somap.put("grandtotal",ifnull(grandtotal,""));
		somap.put("expshipdate",ifnull(salesdetails.Expected_Shipment_Date,""));
		somap.put("custname",ifnull(getsoack.Contact_Name,""));
		//	mesg="Thank you for your order with Carrier Wheels Pvt. Ltd.!  We've received your order" + ifnull(salesdetails.Sale_Order_No,"")  + " , placed on " + ifnull(salesdetails.Sale_Order_Date,"") + ", amounting to " +ifnull(grandtotal,"")+ " .  The estimated delivery is "+ ifnull(salesdetails.Expected_Shipment_Date,"") + ". Please find the sales order attached for your reference. For any questions, feel free to contact us at " + " +91 7456973939. "+ " Thanks again for choosing Carrier Wheels Pvt. Ltd.! ";
		//info mesg;
		whatsapp_manager.WhatsappMsg_ERP_Salesorder_Acknowledgment(mobileno.tostring(),somap);
		sendmail
		[
			from :"erp@carrierwheels.com"
			to :"parthasarathy.m@synprosoft.com"
			subject :"sales order acknowledgement  " + mobileno
			message :"sales order acknowledgement email" + mobileno + "--- " + somap
		]
	}
}

//Button code
void SalesOrder.Send_Whatsapp_SO_Acknowledment(int ID)
{
	openUrl("#Form:Sales_Order_Acknowledgement?Sales_Order_recid=" + input.ID + "&Form_Mode=Whatsapp","popup window","height=<200>,width=<200>");
}
star

Tue Apr 29 2025 23:48:09 GMT+0000 (Coordinated Universal Time)

@shahmeeriqbal

star

Tue Apr 29 2025 21:46:32 GMT+0000 (Coordinated Universal Time)

@1234_5

star

Tue Apr 29 2025 21:05:22 GMT+0000 (Coordinated Universal Time)

@Taimoor

star

Tue Apr 29 2025 20:20:04 GMT+0000 (Coordinated Universal Time)

@1234_5

star

Tue Apr 29 2025 19:03:46 GMT+0000 (Coordinated Universal Time)

@Taimoor

star

Tue Apr 29 2025 12:58:11 GMT+0000 (Coordinated Universal Time)

@codejck

star

Tue Apr 29 2025 12:35:15 GMT+0000 (Coordinated Universal Time) https://appticz.com/cryptocurrency-exchange-development-company

@davidscott

star

Tue Apr 29 2025 10:14:17 GMT+0000 (Coordinated Universal Time)

@codejck

star

Tue Apr 29 2025 09:34:47 GMT+0000 (Coordinated Universal Time) https://www.eversheds-sutherland.com/en/global/capabilities/services/litigation

@fareya

star

Tue Apr 29 2025 08:22:48 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Tue Apr 29 2025 06:55:09 GMT+0000 (Coordinated Universal Time) https://www.coinsclone.com/solana-token-development/

@LilianAnderson #solanatokendevelopment #solanablockchaintokens #highroitokens #cryptotokencreation #solanadevelopmentguide

star

Tue Apr 29 2025 06:18:56 GMT+0000 (Coordinated Universal Time) https://medicaregt.com/products/laboratory-equipmentsuppliers-in-dubai-uae/

@Medicare

star

Tue Apr 29 2025 04:38:14 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Mon Apr 28 2025 21:48:59 GMT+0000 (Coordinated Universal Time)

@v1ral_ITS

star

Mon Apr 28 2025 11:45:02 GMT+0000 (Coordinated Universal Time)

@vishalsingh21

star

Mon Apr 28 2025 11:38:24 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Mon Apr 28 2025 10:50:06 GMT+0000 (Coordinated Universal Time) https://www.coinsclone.com/cryptocurrency-market-making-software/

@CharleenStewar #cryptomarketmakingsoftware #cryptotrading #marketmaking #liquidity

star

Mon Apr 28 2025 10:16:37 GMT+0000 (Coordinated Universal Time)

@shubhangi.b

star

Mon Apr 28 2025 10:16:16 GMT+0000 (Coordinated Universal Time)

@shubhangi.b

star

Mon Apr 28 2025 07:25:51 GMT+0000 (Coordinated Universal Time) https://finsweet.com/client-first/docs/global-styles-embed

@fareya

star

Mon Apr 28 2025 06:28:17 GMT+0000 (Coordinated Universal Time)

@Manjunath

star

Mon Apr 28 2025 01:48:34 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Mon Apr 28 2025 00:39:24 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Sun Apr 27 2025 20:11:40 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Sun Apr 27 2025 06:04:36 GMT+0000 (Coordinated Universal Time) https://www.troniextechnologies.com/blog/how-crypto-exchanges-make-money

@julieeprince #crypto #blockchain

star

Sat Apr 26 2025 16:28:41 GMT+0000 (Coordinated Universal Time) https://www.virtualbox.org/wiki/Linux_Downloads

@makermess

star

Sat Apr 26 2025 16:28:34 GMT+0000 (Coordinated Universal Time) https://www.virtualbox.org/wiki/Linux_Downloads

@makermess

star

Sat Apr 26 2025 16:28:31 GMT+0000 (Coordinated Universal Time) https://www.virtualbox.org/wiki/Linux_Downloads

@makermess

star

Sat Apr 26 2025 12:01:15 GMT+0000 (Coordinated Universal Time) https://skywins365.in/contact

@varun007

star

Fri Apr 25 2025 05:40:54 GMT+0000 (Coordinated Universal Time)

@Rohan@99

star

Fri Apr 25 2025 00:10:43 GMT+0000 (Coordinated Universal Time)

@sem

star

Thu Apr 24 2025 20:56:17 GMT+0000 (Coordinated Universal Time)

@tino

star

Thu Apr 24 2025 20:55:55 GMT+0000 (Coordinated Universal Time)

@tino

star

Thu Apr 24 2025 20:55:24 GMT+0000 (Coordinated Universal Time)

@tino

star

Thu Apr 24 2025 09:50:14 GMT+0000 (Coordinated Universal Time)

@shubhangi.b

star

Thu Apr 24 2025 09:50:13 GMT+0000 (Coordinated Universal Time)

@shubhangi.b

star

Thu Apr 24 2025 07:50:10 GMT+0000 (Coordinated Universal Time)

@shubhangi.b

star

Thu Apr 24 2025 06:23:20 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Thu Apr 24 2025 06:09:31 GMT+0000 (Coordinated Universal Time) https://www.addustechnologies.com/blog/betway-clone-script

@Seraphina

star

Thu Apr 24 2025 05:45:39 GMT+0000 (Coordinated Universal Time) https://dgtool.co.il/%D7%A9%D7%93%D7%A8%D7%95%D7%92-%D7%97%D7%95%D7%95%D7%99%D7%99%D7%AA-%D7%94%D7%A2%D7%9C%D7%90%D7%AA-%D7%94%D7%A7%D7%91%D7%A6%D7%99%D7%9D-%D7%91%D7%90%D7%9C%D7%9E%D7%A0%D7%98%D7%95%D7%A8/

@Shesek

star

Thu Apr 24 2025 01:39:42 GMT+0000 (Coordinated Universal Time)

@exam3

star

Thu Apr 24 2025 00:55:02 GMT+0000 (Coordinated Universal Time)

@exam3

star

Thu Apr 24 2025 00:06:13 GMT+0000 (Coordinated Universal Time)

@exam3

star

Wed Apr 23 2025 23:57:11 GMT+0000 (Coordinated Universal Time)

@exam3

star

Wed Apr 23 2025 23:30:04 GMT+0000 (Coordinated Universal Time)

@exam3

star

Wed Apr 23 2025 21:52:29 GMT+0000 (Coordinated Universal Time)

@shirnunn

star

Wed Apr 23 2025 16:18:05 GMT+0000 (Coordinated Universal Time) https://iyrinhealth.com/product/vidalista-60mg-tadalafil-tablets/

@nickhervey #vidalista #vidalista60 #vidalista60mg #tadalafil

star

Wed Apr 23 2025 13:30:46 GMT+0000 (Coordinated Universal Time)

@exam3

star

Wed Apr 23 2025 11:26:42 GMT+0000 (Coordinated Universal Time)

@Pooja

Save snippets that work with our extensions

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