Snippets Collections
void htmlParserFrom()
{
deal_description = "<p><img src=\"https://media.sunhub.com/pictures/item/image_2a8b93a2.jpg\" alt=\"Hyundai Logo\"></p><h2><strong>Hyundai 405W 132 Half Cell BoB Bifacial Solar Panel</strong></h2><p>As a core energy business entity of HHI, Hyundai Energy Solutions has strong pride in providing high-quality PV products to more than 3,000 customers worldwide.</p><p> </p><h3><strong>Key Features:</strong></h3><ul><li>Maximized Power Generation</li><li>Half-Cut & Multi-Wire Technology</li><li>Anti-LID / PID</li><li>Mechanical Strength</li><li>UL / VDE Test Labs</li><li>Reliable Warranty</li></ul><h3><strong>Products Details:</strong></h3><ul><li>Manufacturing Part number: HIS-S405YH(BK)</li><li>Power Output: 405 Watt</li><li>Cells: 132 Half cut Bifacial cells</li><li>Weight: 46.51 lb</li><li>Dimensions: 75.74 x 40.86 x 1.26 in</li><li>Pallet Qty: 32 Pcs</li><li>Container Qty: 768 Pcs<br><br>Current Stock In: TX, NJ, FL, CA</li></ul>";
// Remove all HTML tags using replaceAll
clean_description = deal_description.replaceAll("<[^>]+>","");
info clean_description;
// This will show the text without HTML tags
}
1.put all these files and folders in a folder called task-manager(create one)

2.[[[[now open cmd in the task manager folder or set the path in cmd to the folder.

Hold Shift and right click on task-manager folder select open terminal or Open Command Window]]]]

3. once opened run these commands in cmd
npm init -y
npm install express mongoose jsonwebtoken bcryptjs cors
npm install dotenv

4. run this finally
  node server.js

if it doesnt work pray to god and leave the internal🙂


    
    


/**
2
 * Make Woodmart WooCommerce variation buttons appear with different styles based on stock status
3
 */
4
​
5
add_action('wp_head', 'add_woodmart_size_variation_css');
6
function add_woodmart_size_variation_css() {
7
    ?>
8
    <style>
9
        /* Available in stock - normal state with green border */
10
        .wd-swatch.wd-in-stock,
11
        div[data-id="pa_size"] .wd-swatch.wd-in-stock {
12
            border: 1px solid #294567 !important;
13
            background-color: #f9fff5 !important;
14
        }
15
        
16
        /* Out of stock but available for backorder - orange styling */
17
        .wd-swatch.wd-backorder,
18
        div[data-id="pa_size"] .wd-swatch.wd-backorder {
19
            background-color: #bbbbbb !important;
20
            border: 1px solid #bbbbbb !important;
21
        }
22
        
23
        .wd-swatch.wd-backorder .wd-swatch-text,
24
        div[data-id="pa_size"] .wd-swatch.wd-backorder .wd-swatch-text {
25
            color: #fff !important;
26
        }
27
        
28
        /* Out of stock and not available for backorder - gray styling */
29
        .wd-swatch.wd-disabled,
30
        div[data-id="pa_size"] .wd-swatch.wd-disabled {
31
            opacity: 0.5 !important;
32
            background-color: #f5f5f5 !important;
33
            border: 1px solid #d6d6d6 !important;
34
            cursor: not-allowed;
35
        }

const express = require('express');
const mongoose = require('mongoose');
const dotenv = require('dotenv');
const cors = require('cors');
const path = require('path');
const authRoutes = require('./routes/auth');
const taskRoutes = require('./routes/tasks');

dotenv.config(); 

const app = express();
const PORT = process.env.PORT || 5000;


app.use(express.json()); 
app.use(cors()); 




mongoose.connect(process.env.MONGO_URI, {
    useNewUrlParser: true,
    useUnifiedTopology: true
  })
  .then(() => console.log('MongoDB connected'))
  .catch(err => console.error('MongoDB connection error:', err));
  

app.use('/api/auth', authRoutes);
app.use('/api/tasks', taskRoutes);


app.listen(process.env.PORT, () =>
    console.log(`Server running on port ${process.env.PORT}`)
  );
  
MONGO_URI=mongodb://127.0.0.1:27017/taskdb
JWT_SECRET=mysecretkey
PORT=5000
//auth.js

const express = require('express');
const bcrypt = require('bcryptjs');
const jwt = require('jsonwebtoken');
const User = require('../models/User');

const router = express.Router();

// Register
router.post('/register', async (req, res) => {
  const { name, email, password } = req.body;

  if (!name || !email || !password) {
    return res.status(400).json({ message: 'All fields are required' });
  }

  try {
    const existingUser = await User.findOne({ email });
    if (existingUser) {
      return res.status(400).json({ message: 'User already exists' });
    }

    const hashedPassword = await bcrypt.hash(password, 10);
    const newUser = new User({
      name,
      email,
      password: hashedPassword,
    });

    await newUser.save();

    res.status(201).json({ message: 'User registered successfully' });
  } catch (err) {
    console.error('Registration failed:', err);
    res.status(500).json({ message: 'Server error during registration' });
  }
});

// Login
router.post('/login', async (req, res) => {
  const { email, password } = req.body;

  try {
    const user = await User.findOne({ email });
    if (!user) return res.status(400).json({ message: 'Invalid credentials' });

    const isMatch = await bcrypt.compare(password, user.password);
    if (!isMatch) return res.status(400).json({ message: 'Invalid credentials' });

    const token = jwt.sign({ _id: user._id }, process.env.JWT_SECRET, {
      expiresIn: '1h'
    });

    res.json({ token });
  } catch (err) {
    console.error('Login failed:', err);
    res.status(500).json({ message: 'Server error during login' });
  }
});

module.exports = router;



//tasks.js

const express = require('express');
const TaskModel = require('../models/Task');
const authMiddleware = require('../middleware/authMiddleware'); // Authentication middleware
const router = express.Router();

// Apply authentication middleware to all routes in this file
router.use(authMiddleware);

// Create a new task
router.post('/create', async (req, res) => {
  const newTask = new TaskModel({
    ...req.body,
    assignedTo: req.user._id, // Assign the task to the authenticated user
  });
  try {
    await newTask.save();
    res.status(201).json(newTask); // Send the created task as response
  } catch (err) {
    res.status(500).json({ error: 'Error creating task' });
  }
});

// Get all tasks for the logged-in user
router.get('/all', async (req, res) => {
  try {
    const userTasks = await TaskModel.find({ assignedTo: req.user._id });
    res.status(200).json(userTasks);
  } catch (err) {
    res.status(500).json({ error: 'Error fetching tasks' });
  }
});

// Get a specific task by ID
router.get('/single/:taskId', async (req, res) => {
  try {
    const task = await TaskModel.findOne({ _id: req.params.taskId, assignedTo: req.user._id });
    if (!task) return res.status(404).json({ error: 'Task not found' });
    res.status(200).json(task);
  } catch (err) {
    res.status(500).json({ error: 'Error fetching task' });
  }
});

// Update a specific task
router.put('/update/:taskId', async (req, res) => {
  try {
    const updatedTask = await TaskModel.findOneAndUpdate(
      { _id: req.params.taskId, assignedTo: req.user._id },
      req.body,
      { new: true }
    );
    if (!updatedTask) return res.status(404).json({ error: 'Task not found' });
    res.status(200).json(updatedTask);
  } catch (err) {
    res.status(500).json({ error: 'Error updating task' });
  }
});

// Delete a task
router.delete('/delete/:taskId', async (req, res) => {
  try {
    const deletedTask = await TaskModel.findOneAndDelete({ _id: req.params.taskId, assignedTo: req.user._id });
    if (!deletedTask) return res.status(404).json({ error: 'Task not found' });
    res.status(200).json({ message: 'Task Deleted' });
  } catch (err) {
    res.status(500).json({ error: 'Error deleting task' });
  }
});

module.exports = router;
//index.html
<!DOCTYPE html>
<html>
<head>
  <title>Login</title>
</head>
<body>
  <h2>Login</h2>
  <input id="email" placeholder="Email" required><br>
  <input id="password" type="password" placeholder="Password" required><br>
  <button onclick="login()">Login</button>
  <p>No account? <a href="register.html">Register here</a></p>

  <script>
    const API = 'http://localhost:5000/api/auth';

    async function login() {
      const email = document.getElementById('email').value;
      const password = document.getElementById('password').value;

      if (!email || !password) {
        alert("Please fill in all fields");
        return;
      }

      try {
        const res = await fetch(`${API}/login`, {
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          body: JSON.stringify({ email, password })
        });

        const data = await res.json();

        if (res.ok) {
          localStorage.setItem('token', data.token);
          alert('Login successful!');
          window.location.href = 'tasks.html';
        } else {
          alert(data.message || 'Login failed');
        }
      } catch (err) {
        console.error('Login error:', err);
        alert('Something went wrong. Please try again.');
      }
    }
  </script>
</body>
</html>


//register.html
<!DOCTYPE html>
<html>
<head>
  <title>Register</title>
</head>
<body>
  <h2>Register</h2>
  <input id="name" placeholder="Full Name" required><br>
  <input id="email" placeholder="Email" required><br>
  <input id="password" type="password" placeholder="Password" required><br>
  <button id="registerBtn">Register</button>
  <p>Already have an account? <a href="index.html">Login here</a></p>

  <script>
    const API = 'http://localhost:5000/api/auth';

    document.getElementById('registerBtn').addEventListener('click', async () => {
      const name = document.getElementById('name').value;
      const email = document.getElementById('email').value;
      const password = document.getElementById('password').value;

      if (!name || !email || !password) {
        return alert('All fields are required.');
      }

      try {
        const res = await fetch(`${API}/register`, {
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          body: JSON.stringify({ name, email, password })
        });

        const data = await res.json();

        if (res.ok) {
          alert(data.message);
          window.location.href = 'index.html';
        } else {
          alert(data.message || 'Registration failed');
        }
      } catch (err) {
        console.error('Register error:', err);
        alert('Something went wrong. Try again.');
      }
    });
  </script>
</body>
</html>


//tasks.html

<!DOCTYPE html>
<html>
<head>
  <title>Task Management</title>
</head>
<body>
  <h2>Manage Your Tasks</h2>

  <div>
    <input id="taskTitle" placeholder="Enter Task Title"><br>
    <input id="taskDescription" placeholder="Enter Description"><br>
    <input id="taskDueDate" type="date"><br>
    <select id="taskStatus">
      <option value="pending">Pending</option>
      <option value="in-progress">In Progress</option>
      <option value="completed">Completed</option>
    </select><br><br>
    <button onclick="addNewTask()">Add New Task</button>
  </div>

  <h3>Task List</h3>
  <ul id="taskList"></ul>

  <script>
    const API_URL = 'http://localhost:5000/api/tasks';
    const userToken = localStorage.getItem('token');

    if (!userToken) {
      alert("You need to log in first.");
      window.location.href = "login.html"; // Redirect to login page if no token found
    }

    // Fetch and display all tasks
    async function getAllTasks() {
      try {
        const response = await fetch(API_URL + '/all', {
          headers: { Authorization: 'Bearer ' + userToken }
        });
        const tasks = await response.json();

        const taskListElement = document.getElementById('taskList');
        taskListElement.innerHTML = '';

        if (tasks.length === 0) {
          taskListElement.innerHTML = '<li>No tasks found.</li>';
        } else {
          tasks.forEach(task => {
            const taskItem = document.createElement('li');
            taskItem.innerHTML = `
              <b>${task.title}</b> - ${task.status}
              <button onclick="deleteTask('${task._id}')">Delete</button>
            `;
            taskListElement.appendChild(taskItem);
          });
        }
      } catch (err) {
        console.error("Fetching tasks failed:", err);
        alert("Error fetching tasks. Please try again.");
      }
    }

    // Add a new task
    async function addNewTask() {
      const title = document.getElementById('taskTitle').value.trim();
      const description = document.getElementById('taskDescription').value.trim();
      const dueDate = document.getElementById('taskDueDate').value;
      const status = document.getElementById('taskStatus').value;

      if (!title) {
        return alert("Title is required.");
      }

      try {
        const response = await fetch(API_URL + '/create', {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            Authorization: 'Bearer ' + userToken
          },
          body: JSON.stringify({ title, description, dueDate, status })
        });

        const responseData = await response.json();
        alert('Task added successfully!');
        getAllTasks();
      } catch (err) {
        console.error("Adding task failed:", err);
        alert("Could not add task.");
      }
    }

    // Delete a task by ID
    async function deleteTask(taskId) {
      if (!confirm("Are you sure you want to delete this task?")) return;

      try {
        const response = await fetch(`${API_URL}/delete/${taskId}`, {
          method: 'DELETE',
          headers: { Authorization: 'Bearer ' + userToken }
        });

        const responseData = await response.json();
        alert(responseData.message);
        getAllTasks();
      } catch (err) {
        console.error("Deleting task failed:", err);
        alert("Could not delete task.");
      }
    }

    // Load tasks when the page loads
    getAllTasks();
  </script>
</body>
</html>
//task.js

const mongoose = require('mongoose');

const TaskSchema = new mongoose.Schema({
  title: { type: String, required: true },
  description: String,
  status: { type: String, enum: ['pending', 'in-progress', 'completed'], default: 'pending' },
  dueDate: Date,
  assignedTo: { type: mongoose.Schema.Types.ObjectId, ref: 'User' }
});

module.exports = mongoose.model('Task', TaskSchema);



//user.js
const mongoose = require('mongoose');

const UserSchema = new mongoose.Schema({
  name: { type: String, required: true },
  email: { type: String, required: true, unique: true },
  password: { type: String, required: true },
  createdAt: { type: Date, default: Date.now }
});

module.exports = mongoose.model('User', UserSchema);

//authMiddleware.js

const jwt = require('jsonwebtoken');

module.exports = function (req, res, next) {
  
  const token = req.header('Authorization')?.split(' ')[1];

  if (!token) return res.status(401).send('Access Denied'); 

  try {

    const verified = jwt.verify(token, process.env.JWT_SECRET);
    req.user = verified; 
    next(); 
  } catch (err) {

    res.status(400).send('Invalid Token');
  }
};
To Deploy all the design for the one report----
CD K:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\
.\DeployAllReportsToSSRS.ps1 -PackageInstallLocation "K:\AosService\PackagesLocalDirectory" -ReportName DrumLabel*
 
to deploy one desighn from report----
CD K:\AosService\PackagesLocalDirectory\Plugins\AxReportVmRoleStartupTask\
.\DeployAllReportsToSSRS.ps1 -PackageInstallLocation "K:\AosService\PackagesLocalDirectory" -ReportName DrumLabel.Medium_DualLang
 
TEXT(MONTH(DATEVALUE({!f_StartDateTimeWithTimeZoneOffset}))) & "/" &
TEXT(DAY(DATEVALUE({!f_StartDateTimeWithTimeZoneOffset}))) & "/" &
TEXT(YEAR(DATEVALUE({!f_StartDateTimeWithTimeZoneOffset}))) & " " &
IF(
    VALUE(MID(TEXT({!f_StartDateTimeWithTimeZoneOffset}), 12, 2)) = 0, 
    "12:" & 
    RIGHT("00" & MID(TEXT({!f_StartDateTimeWithTimeZoneOffset}), 15, 2), 2) & 
    " AM", 
    IF(
        VALUE(MID(TEXT({!f_StartDateTimeWithTimeZoneOffset}), 12, 2)) < 12,
        TEXT(VALUE(MID(TEXT({!f_StartDateTimeWithTimeZoneOffset}), 12, 2))) & ":" & 
        RIGHT("00" & MID(TEXT({!f_StartDateTimeWithTimeZoneOffset}), 15, 2), 2) & 
        " AM",
        IF(
            VALUE(MID(TEXT({!f_StartDateTimeWithTimeZoneOffset}), 12, 2)) = 12,
            "12:" & 
            RIGHT("00" & MID(TEXT({!f_StartDateTimeWithTimeZoneOffset}), 15, 2), 2) & 
            " PM",
            TEXT(VALUE(MID(TEXT({!f_StartDateTimeWithTimeZoneOffset}), 12, 2)) - 12) & ":" & 
            RIGHT("00" & MID(TEXT({!f_StartDateTimeWithTimeZoneOffset}), 15, 2), 2) & 
            " PM"
        )
    )
)
//f_GMTOffset
24 * (DATETIMEVALUE({!$Flow.CurrentDate}) - {!Convert_Today_To_DateTime.datetimeValue})

//Convert_Today_To_DateTime is an UnofficialSF Action - ConvertDateToDatetimeFlowAction

{!dateTimeVariable} + ({!f_GMTOffset}/24)

{
	"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-16: Wednesday, 16th 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-17: Thursday, 17th April :rabbit:",
				"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:"
			}
		}
	]
}
class MockApiService implements ApiService {
  @override
  Future<String> fetchUserName() async {
    return "Mock User"; // Fake data, no delay
  }
}

void main() {
  // For testing, inject the mock
  runApp(
    MaterialApp(
      home: Scaffold(
        body: UserWidget(apiService: MockApiService()),
      ),
    ),
  );
}
void main() {
  runApp(
    MaterialApp(
      home: Scaffold(
        body: UserWidget(apiService: ApiService()),
      ),
    ),
  );
}
class UserWidget extends StatelessWidget {
  final ApiService apiService; // Dependency injected

  UserWidget({required this.apiService});

  @override
  Widget build(BuildContext context) {
    return FutureBuilder<String>(
      future: apiService.fetchUserName(),
      builder: (context, snapshot) {
        if (snapshot.hasData) {
          return Text("User: ${snapshot.data}");
        }
        return CircularProgressIndicator();
      },
    );
  }
}
class UserWidget extends StatelessWidget {
  final ApiService apiService = ApiService(); // Hardcoded dependency

  @override
  Widget build(BuildContext context) {
    return FutureBuilder<String>(
      future: apiService.fetchUserName(),
      builder: (context, snapshot) {
        if (snapshot.hasData) {
          return Text("User: ${snapshot.data}");
        }
        return CircularProgressIndicator();
      },
    );
  }
}
class ApiService {
  Future<String> fetchUserName() async {
    // Simulate an API call
    await Future.delayed(Duration(seconds: 1));
    return "John Doe";
  }
}
$ git remote -v
> origin    https://github.com/YOUR-USERNAME/YOUR-FORK.git (fetch)
> origin    https://github.com/YOUR-USERNAME/YOUR-FORK.git (push)
> upstream  https://github.com/ORIGINAL-OWNER/ORIGINAL-REPOSITORY.git (fetch)
> upstream  https://github.com/ORIGINAL-OWNER/ORIGINAL-REPOSITORY.git (push)
msiexec.exe /package PowerShell-7.5.0-win-x64.msi /quiet ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1 ENABLE_PSREMOTING=1 REGISTER_MANIFEST=1 USE_MU=1 ENABLE_MU=1 ADD_PATH=1
Imagine a shopping platform where products never run out, browsing is lightning-fast, and checkout is as easy as a single click. Our Amazon Clone online store brings you an unmatched shopping experience with a wide range of products, smart recommendations, and smooth navigation. Whether you’re searching for the latest gadgets, fashion, or daily essentials, everything is just a tap away!
Why You’ll Like It?
 Infinite Choices – Browse an endless catalog of products.
 Fast & Easy Search – Find what you need instantly.
 Safe & Secure Payments – Shop with confidence.

Visit now >> https://www.beleaftechnologies.com/amazon-clone
Whatsapp :  +91 8056786622
Email id :  business@beleaftechnologies.com
Telegram : https://telegram.me/BeleafSoftTech 
<lightning-input class="searchBar" data-id="searchBar" type="search" variant="label-hidden" placeholder="Search..."
                onmouseout={handleSearch}>
            </lightning-input>
            <div class="tooltip-pointer">
                <div class="tooltip-content">
                    {searchAttributesText}
                </div>
            </div>

.tooltip-pointer {
    position: absolute;
    z-index: 7000;
    /* opacity: 0;
    visibility: hidden; */
    margin-top: 3rem;
    width: 13.5rem;
    padding: 0.5rem;
    background-color: #003366;
    text-align: left;
    color: white;
}

/* Show tooltip on hover */
.searchBar:hover .tooltip-pointer {
    opacity: 1;
    visibility: visible;
}

/* Triangle pointer at the top of tooltip */
.tooltip-pointer:before {
    content: '';
    position: absolute;
    top: -10px;
    left: 10px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid #003366;
}

.tooltip-content {
    font-size: 13px;
    line-height: 1.5;
}

Teamwork has acquired impeccable recognition among premium firms as the best PR firm in Delhi NCR. We have been providing excellent public relations services in India for years and our PR professionals always focus on result-oriented campaigns. A separate department for everything allows Teamwork to develop ideas and strategies like no other.
Get a feature-rich, scalable, and fully customizable betting platform with live odds, casino games, and secure payments—all modeled after BET365.

Developed by COINSQUEENS – Experts in iGaming Solutions.

Start your betting business today.

For more info:
Call/Whatsapp - +91 87540 53377
Email:sales@coinsqueen.com
Visit https://www.coinsqueens.com/blog/bet365-clone-script 

<%{
	fetinst = Installation[ID == input.rec].ID;
	fetinst1 = Installation[ID == input.rec];
	fetciv = Civil_Work_Detail1[Installation == input.rec].ID;
	fetearth = Product_Details_Check_List[Installation == input.rec].ID;
	fetinst = Installation_SPQ1[Installation == input.rec].ID;
	fetfcc = Final_Connection[Installation == input.rec].ID;
	fetkwh = Kwh_Line_Item_Form[Installation == input.rec].ID;
	fetfccomp = Final_Connection_Checklist_Individual_Yes_No[Installation_Assignment == input.rec].ID;
	fetgin = GIN_ID_Status[Installation == input.rec].ID;
	fetgin1 = GIN_ID_Status[Installation == input.rec];
	fetinstass = Installation_Assignment[Installation == input.rec];
	ginform = Gin_Form[GIN_ID_Status1 == fetgin];
	data = Installation_SPQ1[Installation == input.rec];
	%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <style>
        body.custom-links-page {
            font-family: 'Arial', sans-serif;
            background-color: #f8f8f8;
            margin: 0;
            padding: 10px;
        }

        body.custom-links-page h1 {
            color: #333;
            text-align: center;
        }

        .group-container {
            background-color: #14638e;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            margin-bottom: 10px;
            padding: 10px;
            overflow: hidden;
        }

        .subgroup-container {
            background-color: #f2f2f2;
            border-radius: 8px;
            margin-bottom: 10px;
            padding: 10px;
            overflow: hidden;
        }

        .column {
            width: 33.33%;
            float: left;
            box-sizing: border-box;
            padding: 0 5px;
			margin-right: 10%;
        }
.column1 {
            width: 33.33%;
            float: left;
            box-sizing: border-box;
            padding: 0 5px;
        }
        .column ul {
            list-style-type: none;
            padding: 0;
            margin: 0;
        }

        .column li {
            margin-bottom: 10px;
            border-bottom: 1px solid #ddd;
            padding-bottom: 5px;
        }

        .column a {
            text-decoration: none;
            color: #14638e;
            font-weight: bold;
            transition: color 0.3s ease;
        }

        .column a:hover {
            color: #da251c;
        }


        .column b:hover {
            color: #da251c;
        }

        @media only screen and (max-width: 767px) {
            .column {
                width: 100%;
                float: none;
                margin-bottom: 15px;
            }
        }
    </style>
</head>
<body class="custom-links-page">

    <div class="group-container">
	<h2 style="text-align: center">CHECKLIST</h2>

        <div class="subgroup-container">

			<div class="column">            
                <ul>
<%
	if(fetinst1.No_of_Civil_Work > 0)
	{
		%>
<li><a href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Form:Civil_Work_Detail1?recLinkID=<%=fetciv%>&Redirect=RM&viewLinkName=All_Civil_Work_Details1" target="_blank">Civil Work Checklist</a></li>
<%
	}
	if(fetinst1.No_of_Civil_Work <= 0 || fetinst1.No_of_Civil_Work == null)
	{
		%>
<li><b href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Form:Civil_Work_Detail1?recLinkID=<%=fetciv%>&Redirect=RM&viewLinkName=All_Civil_Work_Details1" target="_blank">Civil Work Checklist</a></li>
<%
	}
	if(fetinst1.No_of_Earthing1 > 0)
	{
		%>
<li><a href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Form:Product_Details_Check_List?recLinkID=<%=fetearth%>&Redirect=RM&viewLinkName=Product_Details_Check_List_Report" target="_blank">Earthing Checklist</a></li>
<%
	}
	if(fetinst1.No_of_Earthing1 <= 0 || fetinst1.No_of_Earthing1 == null)
	{
		%>
<li><b href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Form:Product_Details_Check_List?recLinkID=<%=fetearth%>&Redirect=RM&viewLinkName=Product_Details_Check_List_Report" target="_blank">Earthing Checklist</a></li>
<%
	}
	%>
<li><a href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Form:Installation_SPQ1?recLinkID=<%=fetinst1.Installation_SPQ1%>&Redirect=RM&viewLinkName=Installation_SPQ1_Report&Backend_hide_subform=true" target="_blank">Installation Checklist</a></li>
<%
	if(fetinst1.No_of_7_7_KWh_Chargers > 0)
	{
		%>
<li><a href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Report:kwh_Line_Items?Installation=<%=input.rec%>" target="_blank">View 7.7KWh Checklist</a></li>
<%
	}
	if(fetinst1.No_of_7_7_KWh_Chargers <= 0 || fetinst1.No_of_7_7_KWh_Chargers == null)
	{
		%>
<li><b href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Report:kwh_Line_Items?Installation=<%=input.rec%>" target="_blank">View 7.7KWh Checklist</a></li>
<%
	}
	if(fetinstass.New_Status_Final_Connection != "Vendor assignment pending" || fetinstass.New_Status_Final_Connection == null && fetinst1.Final_Connection != null)
	{
		%>
<li><a href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Form:Final_Connection?recLinkID=<%=fetinst1.Final_Connection%>&Redirect=RM&viewLinkName=All_Final_Connections&zc_LoadIn=dialog" >Final Connection Checklist</a></li>
<%
	}
	if(fetinstass.New_Status_Final_Connection == "Vendor assignment pending" || fetinstass.New_Status_Final_Connection != null || fetinst1.Final_Connection == null)
	{
		%>
<li><b href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Form:Final_Connection?recLinkID=<%=fetfcc%>&Redirect=RM&viewLinkName=All_Final_Connections&zc_LoadIn=dialog">Final Connection Checklist</a></li>
<%
	}
	if(fetinst1.Final_Connection_Checklist_Individual_Yes_No_Multiple == null && fetinst1.Final_Connection_Status == "Final Connection Pending")
	{
		%>
<li><a href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Form:Final_Connection_Checklist_Individual_Yes_No?Installation_Assignment=<%=fetinst1.Installation_Assignment%>&zc_LoadIn=dialog">FC needs to be completed?</a></li>
<%
	}
	if(fetinst1.Final_Connection_Status == "Final Connection Completed" || fetinst1.Final_Connection_Checklist_Individual_Yes_No_Multiple != null)
	{
		%>
<li><b href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Form:Final_Connection_Checklist_Individual_Yes_No?Installation_Assignment=<%=fetfccomp%>" target="_blank">FC needs to be completed?</a></li>
<%
	}
	%>
<!-- Below code is for Proceed for Activation button code-->
<%
	if(fetinst1.Status4 == "Open")
	{
		%>
<li><a href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Form:Copy_of_Approval?Installation_ID=<%=input.rec%>&zc_LoadIn=dialog">Approve</a></li>
<%
	}
	if(fetinst1.Status4 != "Open")
	{
		%>
<li><b href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Report:Network_Engineer_Approval?fetinst1.GIN_ID_Status<%=fetgin%>" target="_blank">Approve</a></li>
<%
	}
	%>
</ul>
            </div>
			<div class="column">            
                <ul>
				<li><a href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Report:All_Civil_Work_Details1?Installation=<%=input.rec%>" target="_blank">Export Civilwork Checklist</a></li>
				<li><a href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Report:Product_Details_Check_List_Report?Installation=<%=input.rec%>" target="_blank">Export Earthing Checklist</a></li>
				<li><a href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Report:Installation_SPQ1_Report?Installation=<%=input.rec%>" target="_blank">Export Installation Checklist</a></li>
				<li><a href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Report:kwh_Line_Items?Installation=<%=input.rec%>" target="_blank">Export 7.7KWh Checklist</a></li>
					<li><a href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Report:All_Final_Connections?Installation=<%=input.rec%>" target="_blank">Export Final Connection Checklist</a></li>
					<li><br></li>
<%
	if(fetinst1.Status4 != "Rejected")
	{
		%>
<li><a href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Form:Reject_Remarks_For_Rm?Installation=<%=input.rec%>&zc_LoadIn=dialog" >Reject</a></li>
<%
	}
	if(fetinst1.Status4 == "Rejected")
	{
		%>
<li><b href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Form:Reject_Remarks_For_Rm?Installation=<%=input.rec%>&zc_LoadIn=dialog">Reject</a></li>
<%
	}
	%>
<!--<li><a href="https://creatorapp.zoho.in/atherenergy/environment/development/atherops/#Form:Test_Approval?Installation_ID=<%=input.rec%>&zc_LoadIn=dialog">Test</a></li>
</ul>-->
            </div>
			 </div>
			
			

</body>
</html>
<%

}%>
void Books.create_bills(int ids)
{
	billdata = Bills[ID == input.ids];
	if(billdata.Books_Bill_ID.isEmpty() == true)
	{
		getID = Bills[ID != null] sort by Books_Bill_ID desc;
		if(getID.count() == 0)
		{
			billdata.Books_Bill_ID="Bill-001";
		}
		else
		{
			var1 = getID.Books_Bill_ID.getsuffix("Bill-");
			if(var1.isEmpty() || !var1.isNumber())
			{
				var2 = 1;
			}
			else
			{
				var2 = var1.tolong() + 1;
			}
			autoList = var2.toString().length();
			TarnsList = {1:"Bill-00",2:"Bill-0",3:"Bill-"};
			billdata.Books_Bill_ID=TarnsList.get(autoList) + var2;
			billnum = TarnsList.get(autoList) + var2;
		}
	}
	// Create Bill Process to Books
	iternal_inv = Internal_Invoice[ID == billdata.Bill_Id1];
	test = billdata.Partner_Details.Zoho_books_ID;
	var_par = Partner_Details[Partner_Entity_Name == billdata.Vendor_Name];
	vendordet = Partner_Onboarding_and_KYC[Partner_Entity_Name == billdata.Vendor_Name];
	book = vendordet.Zoho_Book_vendor_ID;
	info book;
	item_list = List();
	item_map = Map();
	item_map.put("rate",billdata.Total_Amount);
	item_map.put("account_id",2293182000000041035);
	item_map.put("bill_number",billnum);
	// // 	check the GST details from zoho books 
	vendorDetailsResponse = invokeurl
	[
		url :"https://www.zohoapis.in/books/v3/contacts/" + book + "?organization_id=60036667486"
		type :GET
		connection:"zoho_books_connection"
	];
	vendorDetails = vendorDetailsResponse.get("contact");
	gstTreatment = vendorDetails.get("gst_treatment");
	info "GST Treatment: " + gstTreatment;
	// 	   taxResponse = invokeurl
	// 	[
	// 	    url :"https://www.zohoapis.in/books/v3/settings/taxes?organization_id=60036667486"
	// 	    type :GET
	// 	    connection:"zoho_books_connection"
	// 	];
	// 	info taxResponse;
	if(gstTreatment != null)
	{
		item_map.put("gst_treatment_code","out_of_scope");
	}
	item_list.add(item_map);
	Head1 = Map();
	if(billdata.Contracting_organisation == "USDC")
	{
		Head1.put("branch_id",2293182000000188007);
	}
	if(billdata.Contracting_organisation == "Jain University")
	{
		Head1.put("branch_id",2293182000000188048);
	}
	Head1.put("reference_number",billdata.Bill_Id1.Internal_Invoice_ID);
	Head1.put("bill_number",billdata.Books_Bill_ID);
	Head1.put("notes",billdata.Order_Number);
	Head1.put("date_formatted",zoho.currentdate);
	Head1.put("is_draft",true);
	Head1.put("vendor_id",book);
	Head1.put("line_items",item_list);
	//Head1.put("tax_total",billdata.GST_Amount);
	Head1.put("total",billdata.Total_Amount);
	custom_field_list = List();
	customfields = Map();
	customfields.put("api_name","cf_internal_invoice_id");
	customfields.put("value",iternal_inv.ID);
	custom_field_list.add(customfields);
	Head1.put("custom_fields",custom_field_list);
	info customfields;
	var = invokeurl
	[
		url :"https://www.zohoapis.in/books/v3/bills?organization_id=60036667486"
		type :POST
		parameters:Head1.toString()
		connection:"zoho_books_connection"
	];
	info "Bill Creation API Status " + var;
	if(var.get("code") == 0 && var.get("bill") != null)
	{
		// 				/*create record in New Bill*/
		if(var.get("code") == 0 && var.get("bill") != null)
		{
			getBill = var.get("bill");
			addNewBills = insert into New_Bills
			[
				Bill_ID=getBill.get("bill_number")
				Bill_Date=getBill.get("date").toString("dd-mm-YYYY")
				Bill_Status=getBill.get("status")
				Total_Amount=getBill.get("total")
				Vendor_Name=getBill.get("vendor_name")
				Zoho_books_ID=getBill.get("bill_id")
				Internal_Invoice=billdata.Bill_Id1
				Added_User=zoho.loginuser
			];
		}
	}
	billcreateform = Create_Bill[Bills == input.ids];
	// 	invoicebackend = Create_Bill[CP_Internal_Invoice_Backend.inp]
	if(var.getJson("code") == 0)
	{
		for each  recs12 in billcreateform.CP_Internal_Invoice_Backend
		{
			recs12.Bill_Creation_Status="Yes";
		}
		iternal_inv.Invoice_Amount=ifnull(iternal_inv.Invoice_Amount,0) + ifnull(billdata.Total_Amount,0);
		billcreateform.Bill_Creation_Status="Yes";
		billdata.Bill_Creation_Status="Yes";
		bills = var.get("bill");
		bills_id = bills.getJSON("bill_id");
		total1 = bills.getJSON("total");
		iternal_inv.Books_Bill_ID=bills_id;
		// 		info bills_id;
		file = invokeurl
		[
			url :"https://www.zohoapis.in/creator/v2.1/data/centralisedprocurement_usdcglobal/usdc1/report/All_Bills/" + billdata.ID + "/External_Invoice/download"
			type :GET
			connection:"zoho_oauth_connection"
		];
		file.setparamname("attachment");
		info "download files " + file;
		response = invokeurl
		[
			url :"https://www.zohoapis.in/books/v3/bills/" + bills_id + "/attachment?organization_id=60036667486"
			type :POST
			files:file
			connection:"zoho_books_connection1"
		];
		// 		info file;
		billdata.Zoho_Books_Id=bills_id;
		billdata.Total_Invoice_Amount_Incl_GST=total1;
		var_bill = var.get("bill").getJSON("reference_number");
		info "var_bill" + var_bill;
		// 		openUrl("#Report:Associated_Bill?Internal_Invoice_ID=" + var_bill,"same window");
		iternal_inv = Internal_Invoice[ID == billdata.Bill_Id1];
		iternal_inv.Balance_Amount=billdata.Balance_Amount;
		// iternal_inv.Total_Amount=input.Total_Amount;
		iternal_inv.Total_Amount=ifnull(iternal_inv.Total_Amount,0) + billdata.Total_Amount;
		iternal_inv.Balance_Amount=billdata.Accumulated_Commission_Amount - ifnull(iternal_inv.Total_Amount,0);
		iternal_inv.External_Invoice="";
		iternal_inv.Status="New";
		/*Sending mail to CP*/
		// 		sendmail
		// 		[
		// 			from :zoho.adminuserid
		// 			to :billdata.CP_Details1.Partner_Entity_Name,"vimal@techvaria.com"
		// 			subject :"CP Invoice Verification Successfull"
		// 			message :"CP invoice Verification Done and Submitted to Finance team"
		// 		]
		totalAmount = 0;
		item_list = List();
		hard_lst = {1,2};
		for each  split in hard_lst
		{
			if(split == 1)
			{
				get_creator_amount = billdata.Total_Amount;
				get_credit_debit = "debit";
				get_creator_Description = "Comments";
				item_map = Map();
				item_map.put("amount",get_creator_amount);
				item_map.put("debit_or_credit",get_credit_debit);
				item_map.put("account_id",2293182000000114065);
				// 				2293182000000114073
				item_map.put("customer_id",book);
			}
			if(split == 2)
			{
				get_creator_amount = billdata.Total_Amount;
				get_credit_debit = "credit";
				get_creator_Description = "Test";
				item_map = Map();
				item_map.put("amount",get_creator_amount);
				item_map.put("debit_or_credit",get_credit_debit);
				item_map.put("account_id",2293182000000114073);
				item_map.put("customer_id",book);
			}
			item_list.add(item_map);
		}
		mymap = Map();
		if(billdata.Contracting_organisation == "USDC")
		{
			mymap.put("branch_id",2293182000000188007);
		}
		if(billdata.Contracting_organisation == "Jain University")
		{
			mymap.put("branch_id",2293182000000188048);
		}
		mymap.put("journal_date",zoho.currentdate.toString("yyyy-MM-dd"));
		mymap.put("reference_number",billdata.Order_Number);
		mymap.put("notes","test");
		mymap.put("line_items",item_list);
		mymap.put("total",billdata.Total_Invoice_Amount_Incl_GST);
		//mymap.put("tax_total",billdata.GST_Amount);
		responseBooks = invokeurl
		[
			url :"https://www.zohoapis.in/books/v3/journals?organization_id=60036667486"
			type :POST
			parameters:mymap.toString()
			connection:"zoho_books_connection1"
		];
		getJournal = responseBooks.get("journal");
		Zoho_Books_ID = getJournal.get("journal_id");
		file = invokeurl
		[
			url :"https://www.zohoapis.in/creator/v2.1/data/centralisedprocurement_usdcglobal/usdc1/report/All_Bills/" + billdata.ID + "/External_Invoice/download"
			type :GET
			connection:"zoho_oauth_connection"
		];
		file.setparamname("attachment");
		response = invokeurl
		[
			url :"https://www.zohoapis.in/books/v3/journals/" + Zoho_Books_ID + "/attachment?organization_id=60036667486"
			type :POST
			files:file
			connection:"zoho_books_connection1"
		];
	}
	else
	{
		for each  recs123 in billcreateform.CP_Internal_Invoice_Backend
		{
			recs123.Bill_Creation_Status="No";
			recs123.Bill_Creation_Error_Message=var;
		}
		billcreateform.Bill_Creation_Status="No";
		billcreateform.Bill_Creation_Error_Message=var;
		billdata.Bill_Creation_Status="No";
		billdata.Bill_Creation_Error_Message=var;
	}
}
<%{
	%>
<style>
.zc-pb-embed-placeholder-content
{
	font-size: 18px;
	margin-top: 15px !important;
	align: center;
}
.margin
{
	margin-top: 18px !important;
	margin-bottom: 18px !important;
}
.zcpopup.compact .popupbox-wraper .popupbox 
{
width: 60%!important;
max-height: 90%;
height: 80%!important;
overflow: auto;
background: #fff;
}
// a:hover{
// 	background:red;
// }
// button:hover {
// 	background-color:red;
// }
</style>
<%
	// 	ord = Order[Invoice == id.toLong()].Order;
	%>
<div class="zc-pb-embed-placeholder-content">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
	<div class="zc-pb-embed-placeholder-content">&nbsp;&nbsp;&nbsp;&nbsp<%=input.id1%> &nbsp;</div>
	<div style="clear:both" align = "center" class="margin">
	<span>
				<button style="background-color: #5C94C2;
			    border: none;
			    color: white;
			 	padding: 8px 24px;
			    text-align: center;
			    text-decoration: none;
			    display: inline-block;
			    font-size: 12px;
				font-color:#e7e7e7;
			    margin: 4px 2px;
			    cursor: pointer;
			    ">
				<a href="#Script:dialog.close","same window"><font size="4"color="white">Close</font></a></button></span>
		</div>
<%

}%>
void Integrations_to_books.ItemsToBooks_New(int itmid)
{
	fet_itm = Item_Master[ID == input.itmid];
	fetorg = Organization_Master[Organization_Code == fet_itm.Organization_Code.Organization_Code];
	orgid = fetorg.Organization_Code;
	fetapp = Approval[Item_ID.Item_Code == fet_itm.Item_Code];
	app = Approval[Organization_Name == fet_itm.Organization_Name && Item_ID.Item_Code == fet_itm.Item_Code];
	fet_itm.Status="Active";
	if(fet_itm.Item_Type == "Service")
	{
		mattype = "service";
	}
	else
	{
		mattype = "goods";
	}
	itmmap = Map();
	itmmap.put("name",fet_itm.Item_Name);
	itmmap.put("sku",fet_itm.Item_Code);
	itmmap.put("product_type",mattype);
	itmmap.put("unit",fet_itm.UOM);
	if(fet_itm.Selling_Price != null)
	{
		itmmap.put("rate",ifnull(fet_itm.Selling_Price,0.00));
		itmmap.put("description",fet_itm.Selling_Description);
		itmmap.put("account_name",fet_itm.Account.Accounts_Type);
		//itmmap.put("purchase_description",fet_itm.Specification);
	}
	if(fet_itm.Cost_Price != null)
	{
		itmmap.put("purchase_rate",ifnull(fet_itm.Cost_Price,0.00));
		itmmap.put("purchase_description",fet_itm.Purchase_Description);
		itmmap.put("account_name",fet_itm.Account.Accounts_Type);
		//itmmap.put("purchase_description",fet_itm.Specification);
	}
	if(fetapp.Do_You_want_to_create_Item_for_other_organization == "No")
	{
		response_books = invokeurl
		[
			url :"https://www.zohoapis.in/books/v3/items?organization_id=" + orgid
			type :POST
			parameters:itmmap.toString()
			connection:"books"
		];
		info response_books;
		for each  rec1 in app.Organization_Name
		{
			if(0 == response_books.get("code"))
			{
				contect_Data = response_books.get("item");
				zbid = contect_Data.get("item_id");
			}
			// 			ins = insert into Item_Master_Books_Details
			// 			[
			// 				Type_field="Item"
			// 				Added_User=zoho.loginuser
			// 				Organization_Name=rec1.ID
			// 				Item_Master_ID=fet_itm.ID
			// 				Organization_Code=rec1.ID
			// 				Item_Books_ID=zbid
			// 			];
		}
	}
	if(fetapp.Do_You_want_to_create_Item_for_other_organization == "Yes")
	{
		for each  rec in app.Organization_Name
		{
			org = rec.Organization_Code;
			resp = invokeurl
			[
				url :"https://www.zohoapis.in/books/v3/items?organization_id=" + org
				type :POST
				parameters:itmmap.toString()
				connection:"books"
			];
			info resp;
			if(0 == resp.get("code"))
			{
				contect_Data = resp.get("item");
				zbid = contect_Data.get("item_id");
			}
			// 			ins = insert into Item_Master_Books_Details
			// 			[
			// 				Type_field="Item"
			// 				Added_User=zoho.loginuser
			// 				Organization_Name=rec.ID
			// 				Item_Master_ID=fet_itm.ID
			// 				Organization_Code=rec.ID
			// 				Item_Books_ID=zbid
			// 			];
		}
	}
	//266977000000445214
}
void Integrations_to_books.CreditnotesTobooks(int id)
{
	sal = Sales_Order[ID == input.id];
	inv_det = Invoice[Sales_Order_ID == sal];
	// 	info "org "+sal.Organization;
	fetorg = Organization_Master[ID == sal.Organization];
	// 	info fetorg.Organization_Name;
	// 	if(inv_det.Books_Invoice_ID == null || inv_det.Books_Invoice_ID == "")
	// 	{
	// 		info "Error: Invoice ID is missing. Cannot proceed.";
	// 		return;
	// 	}
	// 	else
	// 	{
	// 		info "Invoice ID: " + inv_det.Books_Invoice_ID;
	// 		invid = inv_det.Books_Invoice_ID;
	// 	}
	fetbks = Account_Master_Books_Details[Account_Master_ID == sal.Customer_Name];
	// 	info fetbks.Organization_Code.Organization_Code;
	// 	info fetorg.Organization_Code;
	for each  rec1 in fetbks
	{
		if(rec1.Organization_Code.Organization_Code == fetorg.Organization_Code)
		{
			conbks = rec1.Books_ID;
			//info conbks;
		}
		//info itmbks;
		//	info rec1.Organization_Code.Organization_Code;
	}
	sodate = zoho.currentdate.toString("yyyy-MM-dd");
	main_data = Map();
	main_data.put("customer_id",conbks);
	main_data.put("reference_number",sal.Sales_Order);
	//main_data.put("reference_invoice_type","b2c_others");
	// 	b2c_large
	// 	main_data.put("is_invoice_type_standalone",true);
	// 	main_data.put("creditnote_number",sal.Sales_Order);
	main_data.put("date",sodate);
	// 	invoice_list = List();
	// 	invoice_map = Map();
	// 	invoice_map.put("invoice_id","");
	// 	invoice_map.put("invoice_number","");
	// 	invoice_list.add(invoice_map);
	// 	main_data.put("invoices",invoice_list);
	// 	info invoice_map;
	//  Line Items
	Line_list = List();
	for each  line_data in sal.Order_Details
	{
		item_data = Item_Master[ID == line_data.Item_Name];
		itm = Item_Master_Books_Details[Item_Master_ID == item_data.ID];
		for each  rec in itm
		{
			if(rec.Organization_Code.Organization_Code == fetorg.Organization_Code)
			{
				itmbks = rec.Item_Books_ID;
			}
			//	info itmbks;
			//info rec.Organization_Code.Organization_Code;
		}
		//	info fetorg.Organization_Code;
		line_map = Map();
		// 		Align the line Details
		line_map.put("item_id",itmbks);
		break;
	}
	line_map.put("quantity",1);
	// 		line_map.put("description","test");
	line_map.put("rate",sal.Grand_Total);
	Line_list.add(line_map);
	main_data.put("line_items",Line_list);
	info main_data;
	response_books = invokeurl
	[
		url :"https://www.zohoapis.in/books/v3/creditnotes?organization_id=" + fetorg.Organization_Code
		type :POST
		parameters:main_data.toString()
		connection:"books"
	];
	info response_books;
	if(response_books.get("code") == 0)
	{
		sal.SO_Status="SO Cancelled";
		invoice_data = response_books.get("creditnote");
		sal.CreditNote_Books_ID=invoice_data.get("creditnote_id");
		sal.Creditnote_No=invoice_data.get("creditnote_number");
		sal.Credit_Note_Status="Credit Note Integrated";
		for each  rec_items in sal.Order_Details
		{
			if(rec_items.Service_Details == "Item")
			{
				// 				num = randomnumber(1,9999);
				count3 = Transit_Inventory[ID != null];
				num = count3.count() + 1;
				info "if ";
				data_add = insert into Transit_Inventory
				[
					Added_User=zoho.loginuser
					Item_Name=rec_items.Item_Name
					Quantity=rec_items.Qty
					Date_field=zoho.currentdate
					Rate=sal.Grand_Total
					Deal_ID=sal.Deal_ID
					Transit_Inventory_Number=num
				];
				info data_add;
				sendmail
				[
					from :zoho.adminuserid
					to :"vimal@techvaria.com"
					subject :"item transit"
					message :"transit id " + data_add
				]
			}
		}
	}
	else
	{
		info "Error in API Response: " + response_books;
	}
}
void Integrations_to_books.CancelInvoiceinBooks(int soid)
{
	fetch_inv = Invoice[ID == input.soid];
	fetorg = Organization_Master[ID == fetch_inv.Organization];
	//fetch_so.SO_Status="SO Cancelled";
	mymap = Map();
	stts = "void";
	mymap.put("status",stts);
	books_id = fetch_inv.Books_Invoice_ID;
	test_map = Map();
	header_data = Map();
	header_data.put("content-type","application/json");
	void_so = invokeurl
	[
		url :"https://www.zohoapis.in/books/v3/invoices/" + books_id + "/status/void?organization_id=" + fetorg.Organization_Code
		type :POST
		parameters:test_map
		headers:header_data
		connection:"books"
	];
	thisapp.Integrations_to_books.CancelSOBooks(fetch_inv.Sales_Order_ID);
	// 	info void_so;
}
void Integrations_to_books.AccountsToBooks_New(int accid)
{
	account_data = Account_Master[ID == input.accid];
	fetorg = Organization_Master[Organization_Code == account_data.Organization_Name.Organization_Code];
	orgid = fetorg.Organization_Code;
	fetapp = Approval[Account_ID.Account_ID == account_data.Account_ID];
	//main map
	custom_map = Map();
	custom_map.put("address",account_data.Address.address_line_1);
	custom_map.put("street2",account_data.Address.address_line_2);
	custom_map.put("city",account_data.Address.district_city);
	custom_map.put("state",account_data.Address.state_province);
	custom_map.put("country",account_data.Address.country);
	custom_map.put("zip",account_data.Address.postal_Code);
	//main mapping	
	main_map = Map();
	main_map.put("phone",account_data.Account_Number);
	main_map.put("contact_name",account_data.Account_Name);
	main_map.put("company_name",account_data.Account_Name);
	main_map.put("billing_address",custom_map);
	main_map.put("shipping_address",custom_map);
	main_map.put("email",account_data.Account_Mail);
	main_map.put("contact_type","customer");
	cont_list = List();
	primary_cont_pers = Map();
	primary_cont_pers.put("first_name",account_data.Account_Name);
	primary_cont_pers.put("phone",account_data.Account_Number);
	// 	primary_cont_pers.put("email",account_data.Account_Mail);
	cont_list.add(primary_cont_pers);
	//secndary Contact persons updated.
	if(account_data.Contact_Person_Details != null)
	{
		for each  contacts_val in account_data.Contact_Person_Details
		{
			cont_pers = Map();
			cont_pers.put("first_name",contacts_val.Contact_Person);
			cont_pers.put("phone",contacts_val.Phone_Number);
			// 			cont_pers.put("email",contacts_val.Email);
			cont_pers.put("designation",contacts_val.Designation);
			cont_pers.put("department",contacts_val.Department.Department);
			cont_list.add(cont_pers);
		}
	}
	main_map.put("contact_persons",cont_list);
	app = Approval[Organization_Name == fetapp.Organization_Name && Account_ID == fetapp.Account_ID];
	if(fetapp.Do_you_want_to_create_Customer_Vendor_for_other_organization == "Yes")
	{
		for each  rec in app.Organization_Name
		{
			org = rec.Organization_Code;
			info org;
			info rec.Organization_Name;
			resp = zoho.books.createRecord("contacts",org,main_map,"books");
			info "else books response " + resp;
			res_code = resp.get("code").toLong();
			if(res_code == 0)
			{
				for each  vart1 in account_data.Account_Master_Books_Details
				{
					if(vart1.Organization_Name == rec && vart1.Type_field == "Customer")
					{
						books_id = resp.toMap().get("contact").toMap().get("contact_id");
						vart1.Books_ID=books_id;
						info books_id;
					}
				}
				contact_person_list = List();
				contact_person_list = resp.toMap().get("contact").toMap().get("contact_persons").toList();
				for each  contacts_1 in contact_person_list
				{
					contact_rec = contacts_1.toMap();
					contact_person_id = contact_rec.get("contact_person_id");
					for each  cont in account_data.Contact_Person_Details
					{
						cont.Contact_Person_Booksid=contact_person_id;
						updateContactPersonID = Contact_Person_Details[Account_Master_ID == input.accid];
						if(updateContactPersonID.count() > 0)
						{
							updateContactPersonID.Contact_Person_Booksid=contact_person_id;
						}
					}
				}
			}
			if(0 == resp.get("code"))
			{
				contect_Data = resp.get("contact");
				zbid = contect_Data.get("contact_id");
				ins = insert into Account_Master_Books_Details
				[
					Type_field="Customer"
					Added_User=zoho.loginuser
					Organization_Name=rec.ID
					Account_Master_ID=account_data.ID
					Organization_Code=rec.ID
					Books_ID=zbid
				];
			}
		}
	}
	else
	{
		resp = zoho.books.createRecord("contacts",orgid,main_map,"books");
		info "Create Books " + resp;
		res_code = resp.get("code").toLong();
		if(res_code == 0)
		{
			for each  rec1 in app.Organization_Name
			{
				contect_Data = resp.get("contact");
				zbid = contect_Data.get("contact_id");
				ins = insert into Account_Master_Books_Details
				[
					Type_field="Customer"
					Added_User=zoho.loginuser
					Organization_Name=rec1.ID
					Account_Master_ID=account_data.ID
					Organization_Code=rec1.ID
					Books_ID=zbid
				];
			}
			for each  vart in account_data.Account_Master_Books_Details
			{
				if(app.Organization_Name.contains(vart.Organization_Name) == true && vart.Type_field == "Customer")
				{
					books_id = resp.toMap().get("contact").toMap().get("contact_id");
					vart.Books_ID=books_id;
					info books_id;
				}
			}
			contact_person_list = List();
			contact_person_list = resp.toMap().get("contact").toMap().get("contact_persons").toList();
			for each  contacts_1 in contact_person_list
			{
				contact_rec = contacts_1.toMap();
				contact_person_id = contact_rec.get("contact_person_id");
				for each  cont in account_data.Contact_Person_Details
				{
					cont.Contact_Person_Booksid=contact_person_id;
					updateContactPersonID = Contact_Person_Details[Account_Master_ID == input.accid];
					if(updateContactPersonID.count() > 0)
					{
						updateContactPersonID.Contact_Person_Booksid=contact_person_id;
					}
				}
			}
		}
	}
}
<%{
	deal_id = input.Dealid;
	rec_id = input.scenario_id;
	Field_list = list();
	itmrfq = ITEM_RFQ[Deal_ID.Deal_ID1 == deal_id];
	for each  line_data in rec_id.toList(",")
	{
		Field_list.add(line_data);
	}
	// 	// 	Completed********************************************
	%>
<!DOCTYPE html>
			<html lang="en">
			<head>
			    <meta charset="UTF-8">
			    <meta name="viewport" content="width=device-width, initial-scale=1.0">
			    <title>Quotation Comparison</title>
			    <style>
			        /* Basic Styles */
			        body {
			            font-family: Arial, sans-serif;
			            margin: 0;
			            padding: 0;
			            background-color: #f4f4f4;
			            display: flex;
			//             flex-direction: column;
			//             align-items: center;
			            justify-content: flex-start;
			        }
			        header {
			            background-color: #004b87;
			            color: white;
			            padding: 15px;
			            text-align: center;
			            width: 100%;
			        }
			        header h1 {
			            margin: 0;
			            font-size: 28px;
			        }
			        .scenario-selection {
			            padding: 15px;
			            text-align: center;
			        }
			        .comparison-dashboard {
			            display: flex;
			            justify-content: space-around;
			            margin-top: 20px;
			            padding: 10px;
			        }
			        .scenario {
			            background-color: #fff;
			            padding: 20px;
			            border-radius: 8px;
			            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
			            width: 30%;
			        }
			        h3 {
			            text-align: center;
			        }
			        .key-data table {
			            width: 100%;
			            margin-top: 15px;
			            border-collapse: collapse;
			        }
			        .key-data th, .key-data td {
			            padding: 8px;
			            border: 1px solid #ddd;
			            text-align: left;
			        }
			        .actions {
			            text-align: center;
			            margin-top: 20px;
			        }
			        .actions button {
			            padding: 10px 20px;
			            font-size: 16px;
			            margin: 10px;
			            background-color: #004b87;
			            color: white;
			            border: none;
			            border-radius: 5px;
			            cursor: pointer;
			        }
			        .actions button:hover {
			            background-color: #003366;
			        }
			        /* Modal Styles */
			        .modal {
			            display: none;
			            position: fixed;
			            z-index: 1;
			            left: 0;
			            top: 0;
			            width: 100%;
			            height: 100%;
			            background-color: rgba(0, 0, 0, 0.5);
			        }
			        .modal-content {
			            background-color: white;
			            margin: 15% auto;
			            padding: 20px;
			            border-radius: 8px;
			            width: 40%;
			        }
			        .close {
			            color: #aaa;
			            font-size: 28px;
			            font-weight: bold;
			            cursor: pointer;
			            position: absolute;
			            right: 10px;
			            top: 5px;
			        }
			        .close:hover,
			        .close:focus {
			            color: black;
			            text-decoration: none;
			            cursor: pointer;
			        }
					.tr
   {
   border :1px solid black;
   border-collapse : collapse;
   font-size : 10.5px;
   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 : 10.5px;
   height : 2px;
   background-color : lightsteelblue;
   }
			    </style>
			</head>

			    <div class="comparison-dashboard">
<%
	// 	***************************************
	for each  line_data in rec_id.toList(",")
	{
		fetch_scenario_Data = Scenario[ID == line_data];
		deal = fetch_scenario_Data.Deal;
		fet = Deal[ID == deal];
		if(fetch_scenario_Data.count() > 0)
		{
			data_map = Map();
			for each  line_Data in fetch_scenario_Data.Services
			{
				logistic_price = line_Data.Logistic_Price;
				if(logistic_price != null)
				{
					data_map.put("logistic_price",line_Data.Logistic_Price);
				}
				Supplier_Price = line_Data.Supplier_Price;
				if(Supplier_Price != null)
				{
					data_map.put("Supplier_Price",line_Data.Supplier_Price);
				}
				Target_Price = line_Data.Target_Price;
				if(Target_Price != null)
				{
					data_map.put("Target_Price",line_Data.Target_Price);
				}
				qty = line_Data.Qt_Quintal;
				if(qty != null)
				{
					data_map.put("qty",line_Data.Qt_Quintal);
				}
				Lab_Chargers = line_Data.Lab_Chargers;
				if(Lab_Chargers != null)
				{
					data_map.put("Lab_Chargers",line_Data.Lab_Chargers);
				}
				Branding_Quality_Charges = fetch_scenario_Data.Quality_Price;
				if(Branding_Quality_Charges != null)
				{
					data_map.put("Branding_Quality_Charges",fetch_scenario_Data.Quality_Price);
				}
				Selling_Price = fetch_scenario_Data.Selling_Price;
				if(Selling_Price != null)
				{
					data_map.put("Selling_Price",fetch_scenario_Data.Selling_Price);
				}
				Total_Cost = fetch_scenario_Data.Total_Cost1;
				if(Total_Cost != null)
				{
					data_map.put("Total_Cost",fetch_scenario_Data.Total_Cost1);
				}
				mois_percentage = fet.MOIS;
				if(mois_percentage != null)
				{
					data_map.put("mois_percentage",itmrfq.MOIS_Vendor);
				}
				length = fet.Length_field;
				if(length != null)
				{
					data_map.put("length",itmrfq.Length_Vendor);
				}
				trash = fet.Trash;
				if(length != null)
				{
					data_map.put("trash",itmrfq.Trash_Vendor);
				}
				rd = fet.RD;
				if(rd != null)
				{
					data_map.put("rd",itmrfq.RD_Vendor);
				}
				mic = fet.MIC;
				if(mic != null)
				{
					data_map.put("mic",itmrfq.MIC_Vendor);
				}
				brokerage_per_bale = fetch_scenario_Data.Brokerage1.Brokerage_Value;
				if(brokerage_per_bale != null)
				{
					data_map.put("brokerage_per_bale",fetch_scenario_Data.Brokerage1.Brokerage_Value);
				}
			}
			data_map.put("Item_name",line_Data.Item_Name.Item_Name);
		}
		// 		Fetch Data Goes Here 
		// 		***********************************
		%>
<div class="scenario" id="scenarioB">
			            <h3><%=fetch_scenario_Data.Scenario_ID%></h3>
			            <div class="key-data">
			                <table>
						<!--	<tr><th>Item</th><td><%=ifnull(data_map.get("Item_name"),"Name Empty")%></td></tr>-->
						<!--	<tr><th>Quantity</th><td><%=ifnull(data_map.get("qty"),0)%></td></tr>-->
			                 <!--   <tr><th>Target Price</th><td><%=ifnull(data_map.get("Target_Price"),0)%></td></tr>-->
			                    <tr><th>Purchase price </th><td><%=ifnull(data_map.get("Supplier_Price"),0)%></td></tr>
			                    <tr><th> Freight </th><td><%=ifnull(data_map.get("logistic_price"),0)%></td></tr>
			                    <tr><th>3rd Party Services</th><td><%=ifnull(data_map.get("Lab_Chargers"),0)%></td></tr>
								<tr><th>Branding / Quality Charges</th><td><%=ifnull(data_map.get("Branding_Quality_Charges"),0)%></td></tr>
								 <tr><th>Selling Price </th><td><%=ifnull(data_map.get("Selling_Price"),0)%></td></tr>
								  <tr><th>Total Cost</th><td><%=ifnull(data_map.get("Total_Cost"),0)%></td></tr>
								 <tr><th>Brokerage </th><td><%=ifnull(data_map.get("brokerage_per_bale"),0)%></td></tr>
								 <!-- <tr><th>No. of Bales</th><td><%=ifnull(data_map.get("num_bales"),0)%></td></tr>-->
			    				<tr><th>MOIS %</th><td><%=ifnull(data_map.get("mois_percentage"),0)%></td></tr>
			    				<tr><th>Length</th><td><%=ifnull(data_map.get("length"),"Not Provided")%></td></tr>
			    				<tr><th>Trash</th><td><%=ifnull(data_map.get("trash"),0)%></td></tr>
			   				    <tr><th>RD</th><td><%=ifnull(data_map.get("rd"),"Not Provided")%></td></tr>
			                    <tr><th>MIC</th><td><%=ifnull(data_map.get("mic"),"Not Provided")%></td></tr>
			                 <!--   <tr><th>Total Cost</th><td><%=ifnull(fetch_scenario_Data.Total_Cost1,0)%></td></tr>-->
			                    <tr><th>Delivery Time</th><td>12 days</td></tr>
			                </table>
			            </div>
			        </div>
<%
	}
	// 	***************************************
	fetch_scenario_Data = Scenario[ID == line_data];
	deal = fetch_scenario_Data.Deal;
	fet = Deal[ID == deal];
	if(fetch_scenario_Data.count() > 0)
	{
		data_map1 = Map();
		for each  line_Data in fetch_scenario_Data.Services
		{
			mois_percentage = fet.MOIS;
			if(mois_percentage != null)
			{
				data_map1.put("mois_percentage",itmrfq.MOIS_Vendor);
			}
			length = fet.Length_field;
			if(length != null)
			{
				data_map1.put("length",itmrfq.Length_Vendor);
			}
			trash = fet.Trash;
			if(length != null)
			{
				data_map1.put("trash",itmrfq.Trash_Vendor);
			}
			rd = fet.RD;
			if(rd != null)
			{
				data_map1.put("rd",itmrfq.RD_Vendor);
			}
			mic = fet.MIC;
			if(mic != null)
			{
				data_map1.put("mic",itmrfq.MIC_Vendor);
			}
			brokerage_per_bale = fetch_scenario_Data.Brokerage_Value12;
			if(brokerage_per_bale != null)
			{
				data_map1.put("brokerage_per_bale",fetch_scenario_Data.Brokerage_Value12);
			}
		}
		data_map1.put("Item_name",line_Data.Item_Name.Item_Name);
		// 		Fetch Data Goes Here 
		// 		***********************************
		%>
<div class="scenario" id="scenarioB">
			            <h3>Requested</h3>
			            <div class="key-data">
			                <table>
						<!--	<tr><th>Item</th><td><%=ifnull(data_map1.get("Item_name"),"Name Empty")%></td></tr>-->
						<!--	<tr><th>Quantity</th><td><%=ifnull(data_map1.get("qty"),0)%></td></tr>-->
			                 <!--   <tr><th>Target Price</th><td><%=ifnull(data_map1.get("Target_Price"),0)%></td></tr>-->
			                    <tr><th>Item</th><td><%=ifnull(data_map1.get("Item_name"),"Name Empty")%></td></tr>
			    				<tr><th>MOIS %</th><td><%=ifnull(data_map1.get("mois_percentage"),0)%></td></tr>
			    				<tr><th>Length</th><td><%=ifnull(data_map1.get("length"),"Not Provided")%></td></tr>
			    				<tr><th>Trash</th><td><%=ifnull(data_map1.get("trash"),0)%></td></tr>
			   				    <tr><th>RD</th><td><%=ifnull(data_map1.get("rd"),"Not Provided")%></td></tr>
			                    <tr><th>MIC</th><td><%=ifnull(data_map1.get("mic"),"Not Provided")%></td></tr>
			                 <!--   <tr><th>Total Cost</th><td><%=ifnull(fetch_scenario_Data.Total_Cost1,0)%></td></tr>-->
			                    <tr><th>Delivery Time</th><td>12 days</td></tr>
			                </table>
			            </div>
			        </div>
<%
	}
	%>
</tr>
<!-- Scenario 1 -->
			        <!-- Scenario 2 -->
			        <!-- Scenario 3 -->
			    </div>
			    <!-- Actions -->
			   <!-- <div class="actions"> -->
			     <!--   <button onclick="selectScenario()">Select Scenario</button-->
			      <!--  <button onclick="editScenario()">Edit Scenario</button-->
			   <!--     <button onclick="saveComparison()">Save Comparison</button-->
			     <!--   <button onclick="finalizeDeal()">Generate Final Deal</button-->
			    </div>
			    <!-- Scenario Creation Modal (Hidden) -->
<%

}%>
void defaultFunction(Scenario recID)
{
	recid_list = List();
	result = 0;
	poid = list();
	povendlist = list();
	for each  recval in recID
	{
		poid.add(recval);
		//info recval.Deal.Deal_ID1;
		povendlist.add(recval.Deal);
		//info povendlist;
	}
	for each  linerec in recID
	{
		recid_list.add(linerec.ID);
		line_list = List();
		senari_Data = Scenario[ID == linerec.ID];
		//	senari_Data.Scenario_ID=recid_list;
		for each  line_Data in senari_Data.Services
		{
			line_list.add(line_Data);
		}
		if(line_list.size() > 0)
		{
		}
		else
		{
			result = 1;
		}
	}
	if(result == 0 && povendlist.distinct().size() == 1)
	{
		openUrl("#Page:Quotation_Comparison_page?Deal_bg_id=" + senari_Data.Deal.ID + "&Deal_name=" + senari_Data.Deal_Name + "&Dealid=" + senari_Data.Deal.Deal_ID1 + "&scenario_id=" + recid_list + "&Select_Scenario=" + recid_list,"same window");
	}
	else if(result == 1)
	{
		info "Please review the record line items";
	}
	else
	{
		info "Select the same Deal ID.";
		//openUrl("#Page:Alert?id1=Select the same Deal ID.&zc_LoadIn=dialog","same window");
	}
}
<%{
	item_id = input.Item_ID;
	input.main_sc_id = input.main_sc_id;
	item_fetch = Scenario[ID == input.main_sc_id];
	dealid = input.Deal_ID;
	itmrfq = Scenario_Logistic_Quotation[Deal_ID1.Deal_ID1 == dealid];
	itmrfq1 = Scenario_Item_Quotations[Deal_ID1.Deal_ID1 == dealid];
	dealname = input.Deal_name;
	%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Reports and Form Page</title>
    <style>
        /* Header Styles */
        header {
            background-color: #004b87;
            color: white;
            padding: 15px;
            text-align: center;
            position: relative; /* Allows positioning of button inside the header */
        }

        header h1 {
            margin: 0;
            font-size: 28px;
        }

        header p {
            margin: 5px 0 0;
            font-size: 16px;
        }

        /* Update Margin Button */
        .update {
            position: absolute;
            top: 10px; /* Distance from top */
            right: 20px; /* Distance from the right */
            z-index: 10; /* Ensure it appears above other content */
        }

        .update .create-btn {
            display: inline-block;
            background-color: #28a745; /* Green background */
            color: white;
            padding: 10px 20px;
            font-size: 16px;
            font-weight: bold;
            border: none;
            border-radius: 5px;
            text-decoration: none; /* Remove underline */
            transition: background-color 0.3s, transform 0.2s; /* Smooth transitions */
            cursor: pointer;
        }

        .update .create-btn:hover {
            background-color: #218838; /* Darker green on hover */
            transform: scale(1.05); /* Slightly enlarge on hover */
        }

        .update .create-btn.clicked {
            background-color: #1e7e34; /* Dark green when clicked */
            transform: scale(0.98); /* Slightly decrease size when clicked */
        }

        /* Full height for body and html to avoid scrolling */
        body, html {
            margin: 0;
            padding: 0;
            height: 100%;
            width: 100%;
            background-color: #f4f7fc;
        }

        /* Main container fills entire viewport */
        .report-container {
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            align-items: stretch;
            width: 100%;
            height: 50%;
            box-sizing: border-box;
        }

        /* Row for Reports */
        .report-row {
            display: flex;
            justify-content: space-between;
            gap: 10px;
            width: 100%;
            height: 20%;
            overflow: hidden;
        }

        /* Report Box styling */
        .report-box {
            flex: 1;
            padding: 8px;
            border: 1px solid #ddd;
            border-radius: 8px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
            background-color: #f9f9f9;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            height: 10%;
            box-sizing: border-box;
        }

        .report-box h3 {
            text-align: center;
            font-size: 16px;
            color: #333;
            margin-bottom: 8px;
        }

        .report-box .loading-text {
            text-align: center;
            font-size: 14px;
            color: #888;
        }

        /* Form Box Styling */
        .form-box {
            flex: 1;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 8px;
            background-color: #f9f9f9;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
            height: 20%;
            margin-top: 10px;
            box-sizing: border-box;
        }

        .form-box h3 {
            text-align: center;
            font-size: 16px;
            color: #333;
            margin-bottom: 8px;
        }

        .form-box .loading-text {
            text-align: center;
            font-size: 14px;
            color: #888;
        }
		
		.view-outer-wrapper {
    overflow-x: visible;
    g: 0;
    background-color: #fff;
}
 
.zc-pb-embedlive-container iframe {
    display: inline-block;
    vertical-align: top;
    height: 480px;
}
		

        /* Responsive Styles for Smaller Screens */
        @media (max-width: 768px) {
            .report-container {
                padding: 5px;
            }

            .report-row {
                flex-direction: column;
                height: auto;
            }

            .report-box {
                margin-bottom: 10px;
                min-height: 20px;
            }

            .form-box {
                width: 90%;
                height: auto;
                margin-top: 15px;
            }
			.popup {
				width: 300px;
				height: 150px;
				background-color: lightblue;
				position: relative;
				animation: fadeOut 5s forwards; /* Animation lasts 5 seconds */
			}
        }
    </style>
</head>
<body>

    <!-- Header Section -->
    <header>
        <h1>Scenario Selection</h1>
        <p>Deal ID: <span id="dealId"><%=dealid%></span></p>
		  <!-- Button to Open Popup -->
    <a href="#Form:Margin_Details?zc_LoadIn=dialog" 
       style="display: inline-block; 
              padding: 10px 20px; 
              background-color: #007bff; 
              color: white; 
              text-decoration: none; 
              border-radius: 5px; 
              text-align: center; 
              position: absolute; 
              top: 10px; 
              right: 20px; 
              font-size: 14px; 
              transition: background-color 0.3s, transform 0.2s;" 
       class="update-btn">
        Update Quality Price
    </a>
		


    <div class="report-container">
        <!-- Row for Reports -->
        <div class="report-row">
            <div class="report-box">
                <div  elName="zc-component" viewLinkName="Scenario_Item_Quotations1" params="zc_Header=true&zc_Footer=false&zc_SecHeader=false&Scenario_ID=<%=item_fetch.Scenario_ID%>&Deal_ID1=<%=dealid%>&zc_DuplRec=false&zc_EditRec=false&zc_DelRec=false&zc_ColMenu=false" style="height:300px;overflow:hidden;">
    <p class="loading-text">Loading View...</p>
</div>

            </div>
            <div class="report-box">
<%
	if(item_fetch.Scenario_ID != null && itmrfq1.Scenario_Status = "Scenario Selected")
	{
		%>
<div elName="zc-component" viewLinkName="Scenario_Logistic_Quotations" params="zc_Header=true&zc_Footer=false&zc_SecHeader=false&Scenario_ID=<%=item_fetch.Scenario_ID%>&ITEM_RFQ_ID=<%=itmrfq.ITEM_RFQ_ID%>&zc_DuplRec=false&zc_EditRec=false&zc_DelRec=false&zc_ColMenu=false"  style="height:300px;>
                    <p class="loading-text">Loading View...</p>
<%
	}
	%>
</div>
            </div>

            <div class="report-box">
                <div elName="zc-component" viewLinkName="Scenario_Lab_Quotations" params="zc_Header=true&zc_Footer=false&zc_SecHeader=false&Scenario_ID=<%=item_fetch.Scenario_ID%>&Deal_ID1=<%=dealid%>&zc_DuplRec=false&zc_EditRec=false&zc_DelRec=false&zc_ColMenu=false&zc_EditBulkRec=false" style="height:300px;>
                    <p class="loading-text">Loading View...</p>
                </div>
            </div>
        </div>

        <div class="form-box">
         <!--   <h3>Scenario Form</h3>-->
         <iframe src="https://creatorapp.zoho.in/dev07uat21/organic/Scenario/record-edit/Scenario_S/<%=input.main_sc_id%>?zc_Header=false&zc_Footer=false&zc_BtnBgClr=%23ADD8E6&zc_BtnMovrBgClr=%23008000" width="100%"  ></iframe>



        </div>
    </div>

</body>
</html>
<%

}%>
void defaultFunction.cp(Transactions trans)
{
	Transaction = Transactions[ID in trans];
	idsString = "[";
	for each  test in Transaction
	{
		if(idsString != "[")
		{
			idsString = idsString + ",";
		}
		idsString = idsString + test.ID.toString();
	}
	idsString = idsString + "]";
	getpartneremail = Partner_Onboarding_and_KYC[Partner_Entity_Name == trans.Partner_Entity_Name];
	// 	info getpartneremail.Partner_Representative_Email;
	// 	getpartneremail.Partner_Representative_Email
	getCP = Partner_Details[Partner_Entity_Name == trans.Partner_Entity_Name];
	// 	if(getCP.count() > 0)
	// 	{
	info "inside if";
	content = "<a href='https://creatorapp.zohopublic.in/centralisedprocurement_usdcglobal/usdc1/page-perma/Transaction_Pending_Approval_CP/kTwYJJK70T2DkWhuvCKmWgffFUU6yYwCnRsQSJv1rakuH7yeyOYRMrFhkq4pg9ECbgaMjfEHCGatEPypBy7BtO2JzbD9eOaWkr5y?ID=" + idsString + "'>Click here to View</a>";
	sendmail
	[
		from :zoho.adminuserid
		to :getpartneremail.Partner_Representative_Email
		cc:"indhu@techvaria.com","vimal@techvaria.com","pooja.s@techvaria.com"
		subject :"Action Required - New commission calculation initiated by " + trans.Contracting_organisation.Contracting_organisation + " for confirmation"
		message :"New commission calculation is initiated with " + trans.Contracting_organisation.Contracting_organisation + ".<br>" + content + "<br>" + "To view records and confirm the commission calculation."
	]
	// 	}
}
void Transactions.Calculate_Commission(int ids)
{
	transactiondet = Transactions[ID == input.ids];
	if(transactiondet.Validation_Check_Status == "Valid")
	{
		ratecard = RATE_CARD[Partner_Entity_Name.Partner_Entity_Name == transactiondet.Partner_Entity_Name];
		if(ratecard.count() == 0)
		{
			transactiondet.Commission_Comments="Invalid record, commission cannot be calculated.";
			//transactiondet.Commission_Comments="Partner Entity Name is not matching with the rate card.";
		}
		else
		{
			ratecard1 = RATE_CARD[Partner_Entity_Name.Partner_Entity_Name == transactiondet.Partner_Entity_Name && University_Name.University_Name == transactiondet.University_Name];
			if(ratecard1.count() == 0)
			{
				transactiondet.Commission_Comments="Invalid record, commission cannot be calculated.";
				//transactiondet.Commission_Comments="University name is not matching with the rate card.";
			}
			else
			{
				ratecard2 = RATE_CARD[Partner_Entity_Name.Partner_Entity_Name == transactiondet.Partner_Entity_Name && University_Name.University_Name == transactiondet.University_Name && Programs.Programs == transactiondet.Program];
				if(ratecard2.count() == 0)
				{
					transactiondet.Commission_Comments="Invalid record, commission cannot be calculated.";
					//transactiondet.Commission_Comments="Program is not matching with the rate card.";
				}
				else
				{
					ratecard3 = RATE_CARD[Partner_Entity_Name.Partner_Entity_Name == transactiondet.Partner_Entity_Name && University_Name.University_Name == transactiondet.University_Name && Programs.Programs == transactiondet.Program && Elective.Elective == transactiondet.Elective];
					if(ratecard3.count() == 0)
					{
						transactiondet.Commission_Comments="Invalid record, commission cannot be calculated.";
						//transactiondet.Commission_Comments="Elective is not matching with the rate card.";
					}
					else
					{
						ratecard4 = RATE_CARD[Partner_Entity_Name.Partner_Entity_Name == transactiondet.Partner_Entity_Name && University_Name.University_Name == transactiondet.University_Name && Programs.Programs == transactiondet.Program && Elective.Elective == transactiondet.Elective && CP_Approval_Status == "Approved"];
						if(ratecard4.count() == 0)
						{
							transactiondet.Commission_Comments="Invalid record, commission cannot be calculated.";
							//transactiondet.Commission_Comments="Rate Card is not yet approved.";
						}
						else
						{
							// 							ratecard5 = RATE_CARD[Partner_Entity_Name.Partner_Entity_Name == transactiondet.Partner_Entity_Name && University_Name.University_Name == transactiondet.University_Name && Programs.Programs == transactiondet.Program && Elective.Elective == transactiondet.Elective && CP_Approval_Status == "Approved" && Documentation_Status == transactiondet.Documentation_Status1];
							// 							if(ratecard5.count() == 0)
							// 							{
							// 								transactiondet.Commission_Comments="Documentation status is not matching with the rate card."; && Documentation_Status == transactiondet.Documentation_Status1
							// 							}
							// 							else
							// 							{
							ratecard_det = RATE_CARD[Partner_Entity_Name.Partner_Entity_Name == transactiondet.Partner_Entity_Name && University_Name.University_Name == transactiondet.University_Name && Programs.Programs == transactiondet.Program && Elective.Elective == transactiondet.Elective && CP_Approval_Status == "Approved"];
							// 	info ratecard_det.count();&&Documentation_Status == transactionde
							if(ratecard_det.count() == 0)
							{
								transactiondet.Commission_Comments="Invalid record, commission cannot be calculated.";
								//transactiondet.Commission_Comments="No valid rate card details is available for this transaction.";
							}
							else
							{
								for each  recs in ratecard_det
								{
									if(transactiondet.Enrollment_Date >= recs.Effective_start_date && transactiondet.Enrollment_Date <= recs.Effective_end_date)
									{
										t1 = ifnull(transactiondet.Registration_fee,0) + ifnull(transactiondet.Exam_fee,0) + ifnull(transactiondet.Loan_subvention_charges,0);
										transactiondet.Eligible_fee=ifnull(transactiondet.Total_Fee,0) - t1;
										payout_percentage = recs.Payout;
										transactiondet.Accumulated_Commission_Amount=payout_percentage / 100 * transactiondet.Eligible_fee;
										transactiondet.Commission_Comments="Commission calculated successfully.";
										//	transactiondet.Commission_Comments="Commission Amount has been calculated.";
									}
									else
									{
										transactiondet.Commission_Comments="Invalid record, commission cannot be calculated.";
										//transactiondet.Commission_Comments="Effective start date and end date is not matched with the enrolment date.";
										// 			info "else";
									}
								}
							}
						}
					}
				}
			}
		}
	}
	// 	}
	else
	{
		transactiondet.Commission_Comments="This transaction is not valid and commission amount cannot be calculated.";
	}
}
void Transactions.get_Transaction_Validations(int getdata)
{
	getTransInfo = Transactions[ID == input.getdata];
	idsString = "";
	count = getTransInfo.count();
	startIndex = 0;
	// 	
	for each  test in getTransInfo
	{
		// Assign Transaction ID based on the index
		// 		if(startIndex < 1000)
		// 		{
		// 			test.Transaction="TNID-001";
		// 		}
		// 		else if(startIndex < 2000)
		// 		{
		// 			test.Transaction="TNID-002";
		// 		}
		// 		else if(startIndex < 3000)
		// 		{
		// 			test.Transaction="TNID-003";
		// 		}
		// 		else if(startIndex < 4000)
		// 		{
		// 			test.Transaction="TNID-004";
		// 		}
		// 		else if(startIndex < 5000)
		// 		{
		// 			test.Transaction="TNID-005";
		// 		}
		// 		info "Record ID: " + test.ID.toString() + " | Start Index: " + startIndex + " | Transaction: " + test.Transaction;
		startIndex = startIndex + 1;
		// Maintain ID String
		if(idsString != "")
		{
			idsString = idsString + ",";
		}
		idsString = idsString + test.ID.toString();
		// Generate Application Number
		// 		getID = Transactions[ID != null] sort by Application_No1 desc;
		// 		if(getID.count() == 0)
		// 		{
		// 			test.Application_No1="APP-001";
		// 		}
		// 		else
		// 		{
		// 			var1 = getID.Application_No1.getsuffix("APP-");
		// 			if(var1.isEmpty() || !var1.isNumber())
		// 			{
		// 				var2 = 1;
		// 			}
		// 			else
		// 			{
		// 				var2 = var1.toLong() + 1;
		// 			}
		// 			autoList = var2.toString().length();
		// 			TarnsList = {1:"APP-00",2:"APP-0",3:"APP-"};
		// 			test.Application_No1=TarnsList.get(autoList) + var2;
		// 		}
		// 		// Fetch Partner Category
		// 		getcategory = Partner_Enquiry[Partner_Entity_Name == test.Partner_Entity_Name];
		// 		// 		test.Partner_Category=getcategory.Partner_Category;
		// 		// Perform Validation Checks
		// 		for each  getValidation in Validation_Rule_Master[Partner_Category.Partner_Category == test.Partner_Category]
		// 		{
		// 			if(getValidation.count() > 0)
		// 			{
		// 				if(test.Documentation_Status == getValidation.Valid_Tags)
		// 				{
		// 					test.Document_Check=true;
		// 				}
		// 			}
		// 			else
		// 			{
		// 				test.Document_Check=false;
		// 			}
		// 		}
		// 		for each  getValidation in Validation_Rule_Master[Partner_Category.Partner_Category == test.Partner_Category]
		// 		{
		// 			if(getValidation.count() > 0)
		// 			{
		// 				if(test.Program == getValidation.Valid_Tags)
		// 				{
		// 					test.Program_check=true;
		// 				}
		// 			}
		// 			else
		// 			{
		// 				test.Program_check=false;
		// 			}
		// 		}
		// 		for each  getValidation in Validation_Rule_Master[Partner_Category.Partner_Category == test.Partner_Category]
		// 		{
		// 			if(getValidation.count() > 0)
		// 			{
		// 				if(test.Elective == getValidation.Valid_Tags)
		// 				{
		// 					test.Elective_Check=true;
		// 				}
		// 			}
		// 			else
		// 			{
		// 				test.Elective_Check=false;
		// 			}
		// 		}
		// 		// Final Validation Check
		// 		if(test.Document_Check == true && test.Elective_Check == true && test.Program_check == true)
		// 		{
		// 		test.Validation_Check_Status="Valid";
		// 		}
		// 		else
		// 		{
		// 			test.Validation_Check_Status="Invalid";
		// 		}
		// Fetch Partner Name
		//	partner = Partner_Details[Partner_ID == test.Partner_ID];
		//	test.Partner_Entity_Name=partner.Partner_Entity_Name;
		//fetch Address
		getAddress = Partner_Onboarding_and_KYC[Partner_Entity_Name == test.Partner_Entity_Name];
		test.Partner_Address=getAddress.Partner_Address;
		test.Partner_Category=getAddress.Partner_Category;
		ratecarddet1 = RATE_CARD[Partner_Entity_Name.Partner_Entity_Name == test.Partner_Entity_Name];
		thisapp.Transactions.CreateTransactionID(test.ID);
		if(ratecarddet1.count() == 0)
		{
			test.Validation_Comments="Partner entity not onboarded in Partner Master Data. Complete onboarding process and re-initiate transactions.";
			//test.Validation_Comments="Partner Entity name is not matching with the rate card.";
			test.Validation_Check_Status="Invalid";
			//test.Transaction="";
		}
		else
		{
			ratecarddet2 = RATE_CARD[Partner_Entity_Name.Partner_Entity_Name == test.Partner_Entity_Name && University_Name.University_Name == test.University_Name];
			if(ratecarddet2.count() == 0)
			{
				test.Validation_Comments="University not updated in masters. Update University Master and re-initiate transactions.";
				//test.Validation_Comments="University is not matching with the rate card.";
				test.Validation_Check_Status="Invalid";
				//test.Transaction="";
			}
			else
			{
				ratecarddet3 = RATE_CARD[Partner_Entity_Name.Partner_Entity_Name == test.Partner_Entity_Name && University_Name.University_Name == test.University_Name && Elective.Elective == test.Elective];
				if(ratecarddet3.count() == 0)
				{
					test.Validation_Comments="Elective not updated in masters. Update Elective Master and re-initiate transactions.";
					//	test.Validation_Comments="Elective is not matching with the rate card.";
					test.Validation_Check_Status="Invalid";
					//test.Transaction="";
				}
				else
				{
					// 					info "program " + test.Program;
					// 					info "rate card program " + ratecarddet3.Programs.Programs;
					ratecarddet4 = RATE_CARD[Partner_Entity_Name.Partner_Entity_Name == test.Partner_Entity_Name && University_Name.University_Name == test.University_Name && Elective.Elective == test.Elective && Programs.Programs == test.Program];
					if(ratecarddet4.count() == 0)
					{
						test.Validation_Comments="Program not updated in the master. Update Program Master and re-initiate transactions.";
						//test.Validation_Comments="Program is not matching with the rate card.";
						test.Validation_Check_Status="Invalid";
						//test.Transaction="";
					}
					else
					{
						ratecarddet5 = RATE_CARD[Partner_Entity_Name.Partner_Entity_Name == test.Partner_Entity_Name && University_Name.University_Name == test.University_Name && Elective.Elective == test.Elective && Programs.Programs == test.Program && CP_Approval_Status == "Approved"];
						// 						info "rate card 5 " + ratecarddet4;
						if(ratecarddet5.count() == 0)
						{
							test.Validation_Comments="Rate Card is not approved.";
							test.Validation_Check_Status="Invalid";
							//test.Transaction="";
						}
						else
						{
							validStatuses = {"Category A","Category B","Category C","Category D","Category E","Category F","L1 verified","L2 verified","Re-upload required"};
							if(!validStatuses.contains(test.Documentation_Status1.Document_Status))
							{
								test.Validation_Comments="Document Status is Invalid";
								test.Validation_Check_Status="Invalid";
							}
							else
							{
								/*Fetch Payout*/
								getPayout = RATE_CARD[Elective.Elective == test.Elective && Programs.Programs == test.Program && Partner_Entity_Name.Partner_Entity_Name == test.Partner_Entity_Name && University_Name.University_Name == test.University_Name && CP_Approval_Status == "Approved"];
								if(getPayout.count() > 0)
								{
									for each  recs in getPayout
									{
										getpartnerid = Partner_Onboarding_and_KYC[Partner_Entity_Name == recs.Partner_Entity_Name.Partner_Entity_Name];
										if(test.Enrollment_Date >= recs.Effective_start_date && test.Enrollment_Date <= recs.Effective_end_date)
										{
											test.Partner_ID=getpartnerid.Partner_ID;
											test.Contracting_organisation=getpartnerid.Contracting_organisation1;
											test.Validation_Check_Status="Valid";
											test.Validation_Comments="Ready for commission calculation.";
											// 										if(test.Validation_Check_Status == "Valid")
											// 										{
											// 										}
											/*create Transaction ID*/
											test.Payout=getPayout.Payout;
											//	info "info test id " + test.ID;
											// 										thisapp.Transactions.Trasaction_ID(test.ID);
										}
										else
										{
											test.Validation_Comments="No approved rate card found for the enrollment date.";
											//test.Validation_Comments="Effective start and end date is not macthing with the enrollment date.";
											test.Validation_Check_Status="Invalid";
											test.Transaction="";
										}
									}
								}
							}
						}
					}
				}
			}
		}
		// 		else
		// 		{
		// 			test.Validation_Check_Status="Invalid";
		// 		}
		// 		/* Fetch Partner ID*/
		getPartner = Partner_Details[Partner_Entity_Name == test.Partner_Entity_Name];
		if(getPartner.count() > 0)
		{
			test.Partner_ID=getPartner.Partner_ID;
		}
		// Redirect if validation status is not pending
		// 		if(test.Validation_Check_Status != "Pending")
		// 		{
		// 			openUrl("#Report:Transactions_Status","same window");
		// 		}
		// Set Internal Invoice Status
		test.Internal_Invoice_Status="Open";
		// CP Validation
		cp_mas = Partner_Details[Partner_Entity_Name == test.Partner_Entity_Name];
		if(cp_mas.count() > 0)
		{
			test.CP_Master_Validation="Success";
			test.Send_mail_to_CP="Yes";
		}
		else
		{
			test.CP_Master_Validation="Failure";
		}
		// Send Email if required
		if(getTransInfo.Send_mail_to_CP == "Yes" && getTransInfo.CP_Master_Validation == "Success")
		{
			getCP = Rate_Card_Master[Partner_Entity_Name == getTransInfo.Partner_Entity_Name];
			if(getCP.count() > 0)
			{
				Content = "<a href='https://creatorapp.zohopublic.in/centralisedprocurement_usdcglobal/usdc1/report-perma/Transactions_Status/ZpWz5PETb5DNQJuNmJHRxJmPvTtxJnr194fJAF5SgQDyQdymhZA3tj955m5eOFgXFhKWyWh57O8tWNw3WGDj4XYVEGfdCYP2P79G?ID=" + getTransInfo.ID + "'>Click here to View</a>";
				sendmail
				[
					from :zoho.adminuserid
					to :"vimal@techvaria.com"
					subject :"Review Transaction"
					message :"Dear " + getCP.Partner_Entity_Name + ",<br><br>Your Accumulated Commission Calculation was successful.<br><br>Please take a moment to review the details and let us know if you have any questions or concerns.<br><br>" + Content + "<br><br>If you require further information or clarification, feel free to reach out to us.<br><br>Best Regards,<br>Team"
				]
			}
		}
	}
}
void RateCard.getValidations(int ids)
{
	RateCardID = RATE_CARD[ID == input.ids];
	if(RateCardID.CP_Validation == "" || RateCardID.CP_Validation == "Failure")
	{
		//	info "inside if ";
		verification_inv = RATE_CARD[ID in RateCardID];
		idsString = "";
		Internal_User = zoho.loginuserid;
		getID = RATE_CARD[ID != null] sort by Rate_Card_ID desc;
		var2 = 0;
		if(getID == null)
		{
			var2 = 1;
		}
		else
		{
			lastRateCardID = getID.Rate_Card_ID;
			suffix = lastRateCardID.getsuffix("RA-");
			if(!suffix.isEmpty())
			{
				var2 = suffix.toLong() + 1;
			}
			else
			{
				var2 = 1;
			}
		}
		for each  test in verification_inv
		{
			// Append IDs to idsString
			if(idsString != "")
			{
				idsString = idsString + ",";
			}
			idsString = idsString + test.ID.toString();
			autoList = var2.toString().length();
			RateList = {1:"RA-00",2:"RA-0",3:"RA-"};
			Rate_Card_ID = RateList.get(autoList) + var2;
			test.Rate_Card_ID=Rate_Card_ID;
			var2 = var2 + 1;
			// 			cp_mas = Rate_Card_Master[Partner_Entity_Name == test.Partner_Entity_Name.Partner_Entity_Name && Contracting_organisation == test.Contracting_organisation];
			// 			if(cp_mas.count() > 0)
			// 			{
			// 				test.CP_Validation="Success";
			// 			}
			// 			else
			// 			{
			// 				test.CP_Validation="Failure";
			// 			}
			cp_mas = Partner_Onboarding_and_KYC[Partner_Entity_Name == test.Partner_Entity_Name.Partner_Entity_Name && Contracting_organisation1 == test.Contracting_organisation];
			// 			cp_mas = Partner_Details[Partner_Entity_Name == test.Partner_Entity_Name.Partner_Entity_Name && Contracting_organisation == test.Contracting_organisation];
			// 			masterdata = Partner_Onboarding_and_KYC[Partner_Entity_Name == test.pa]
			//	info "partner name " + test.Partner_Entity_Name.Partner_Entity_Name;
			//	info "org " + test.Contracting_organisation;
			if(cp_mas.count() > 0)
			{
				test.CP_Validation="Success";
			}
			else
			{
				test.CP_Validation="Failure";
				test.Validation_Comments="Contracting organisation does not match as per Partner Master Data. Rectify the data and re-initiate rate card import.";
			}
			// 			if(test.CP_Validation = "Success")
			// 			{
			getPartnerInfo = Partner_Onboarding_and_KYC[Partner_Entity_Name == test.Partner_Entity_Name.Partner_Entity_Name];
			if(getPartnerInfo.count() > 0)
			{
				//		info "PARTNERID"+ getPartnerInfo.Partner_ID;
				test.Partner_Unique_ID=getPartnerInfo.Partner_ID;
			}
			//	}
		}
		// 		openUrl("https://creatorapp.zoho.in/centralisedprocurement_usdcglobal/usdc1/#Report:Approved_Rate_Card_By_Internal_User","same window");
	}
	else
	{
		info "This RateCard was already validate";
	}
	thisapp.RateCard.getRateCardMaster(input.ids);
}
void RateCard.Generate_ratecard_id(int ids)
{
	verification_inv = RATE_CARD[ID == input.ids];
	getID = RATE_CARD[ID != null] sort by Rate_Card_ID desc;
	if(getID == null)
	{
		var2 = 1;
	}
	else
	{
		lastRateCardID = getID.Rate_Card_ID;
		suffix = lastRateCardID.getsuffix("RA-");
		if(!suffix.isEmpty())
		{
			var2 = suffix.toLong() + 1;
		}
		else
		{
			var2 = 1;
		}
	}
	for each  test in verification_inv
	{
		partnerdet = Partner_Onboarding_and_KYC[Partner_Entity_Name == test.Partner_Entity_Name.Partner_Entity_Name];
		autoList = var2.toString().length();
		RateList = {1:"RA-00",2:"RA-0",3:"RA-"};
		Rate_Card_ID = RateList.get(autoList) + var2;
		// 		info Rate_Card_ID;
		test.Rate_Card_ID=Rate_Card_ID;
		test.Partner_Unique_ID=partnerdet.Partner_ID;
	}
}
void Test1.testpayment(int id)
{
	fetpay = Payment_form[ID == id];
	fetinv = Internal_Invoice[ID == fetpay.CP_Internal_Invoice_ID];
	cp_invoice_id = fetpay.CP_Internal_Invoice_ID;
	all_payments = Payment_form[CP_Internal_Invoice_ID == cp_invoice_id];
	pay = 0;
	for each  rec in all_payments
	{
		pay = pay + rec.Payment_Amount.toDecimal();
	}
	fetinv.Paid_Amount=pay;
}
void Books.create_bills(int ids)
{
	billdata = Bills[ID == input.ids];
	if(billdata.Books_Bill_ID.isEmpty() == true)
	{
		getID = Bills[ID != null] sort by Books_Bill_ID desc;
		if(getID.count() == 0)
		{
			billdata.Books_Bill_ID="Bill-001";
		}
		else
		{
			var1 = getID.Books_Bill_ID.getsuffix("Bill-");
			if(var1.isEmpty() || !var1.isNumber())
			{
				var2 = 1;
			}
			else
			{
				var2 = var1.tolong() + 1;
			}
			autoList = var2.toString().length();
			TarnsList = {1:"Bill-00",2:"Bill-0",3:"Bill-"};
			billdata.Books_Bill_ID=TarnsList.get(autoList) + var2;
			billnum = TarnsList.get(autoList) + var2;
		}
	}
	// Create Bill Process to Books
	iternal_inv = Internal_Invoice[ID == billdata.Bill_Id1];
	test = billdata.Partner_Details.Zoho_books_ID;
	var_par = Partner_Details[Partner_Entity_Name == billdata.Vendor_Name];
	vendordet = Partner_Onboarding_and_KYC[Partner_Entity_Name == billdata.Vendor_Name];
	book = vendordet.Zoho_Book_vendor_ID;
	info book;
	item_list = List();
	item_map = Map();
	item_map.put("rate",billdata.Total_Amount);
	item_map.put("account_id",2293182000000041035);
	item_map.put("bill_number",billnum);
	// // 	check the GST details from zoho books 
	vendorDetailsResponse = invokeurl
	[
		url :"https://www.zohoapis.in/books/v3/contacts/" + book + "?organization_id=60036667486"
		type :GET
		connection:"zoho_books_connection"
	];
	vendorDetails = vendorDetailsResponse.get("contact");
	gstTreatment = vendorDetails.get("gst_treatment");
	info "GST Treatment: " + gstTreatment;
	// 	   taxResponse = invokeurl
	// 	[
	// 	    url :"https://www.zohoapis.in/books/v3/settings/taxes?organization_id=60036667486"
	// 	    type :GET
	// 	    connection:"zoho_books_connection"
	// 	];
	// 	info taxResponse;
	if(gstTreatment != null)
	{
		item_map.put("gst_treatment_code","out_of_scope");
	}
	item_list.add(item_map);
	Head1 = Map();
	if(billdata.Contracting_organisation == "USDC")
	{
		Head1.put("branch_id",2293182000000188007);
	}
	if(billdata.Contracting_organisation == "Jain University")
	{
		Head1.put("branch_id",2293182000000188048);
	}
	Head1.put("reference_number",billdata.Bill_Id1.Internal_Invoice_ID);
	Head1.put("bill_number",billdata.Books_Bill_ID);
	Head1.put("notes",billdata.Order_Number);
	Head1.put("date_formatted",zoho.currentdate);
	Head1.put("is_draft",true);
	Head1.put("vendor_id",book);
	Head1.put("line_items",item_list);
	//Head1.put("tax_total",billdata.GST_Amount);
	Head1.put("total",billdata.Total_Amount);
	custom_field_list = List();
	customfields = Map();
	customfields.put("api_name","cf_internal_invoice_id");
	customfields.put("value",iternal_inv.ID);
	custom_field_list.add(customfields);
	Head1.put("custom_fields",custom_field_list);
	info customfields;
	var = invokeurl
	[
		url :"https://www.zohoapis.in/books/v3/bills?organization_id=60036667486"
		type :POST
		parameters:Head1.toString()
		connection:"zoho_books_connection"
	];
	info "Bill Creation API Status " + var;
	if(var.get("code") == 0 && var.get("bill") != null)
	{
		// 				/*create record in New Bill*/
		if(var.get("code") == 0 && var.get("bill") != null)
		{
			getBill = var.get("bill");
			addNewBills = insert into New_Bills
			[
				Bill_ID=getBill.get("bill_number")
				Bill_Date=getBill.get("date").toString("dd-mm-YYYY")
				Bill_Status=getBill.get("status")
				Total_Amount=getBill.get("total")
				Vendor_Name=getBill.get("vendor_name")
				Zoho_books_ID=getBill.get("bill_id")
				Internal_Invoice=billdata.Bill_Id1
				Added_User=zoho.loginuser
			];
		}
	}
	billcreateform = Create_Bill[Bills == input.ids];
	// 	invoicebackend = Create_Bill[CP_Internal_Invoice_Backend.inp]
	if(var.getJson("code") == 0)
	{
		for each  recs12 in billcreateform.CP_Internal_Invoice_Backend
		{
			recs12.Bill_Creation_Status="Yes";
		}
		iternal_inv.Invoice_Amount=ifnull(iternal_inv.Invoice_Amount,0) + ifnull(billdata.Total_Amount,0);
		billcreateform.Bill_Creation_Status="Yes";
		billdata.Bill_Creation_Status="Yes";
		bills = var.get("bill");
		bills_id = bills.getJSON("bill_id");
		total1 = bills.getJSON("total");
		iternal_inv.Books_Bill_ID=bills_id;
		// 		info bills_id;
		file = invokeurl
		[
			url :"https://www.zohoapis.in/creator/v2.1/data/centralisedprocurement_usdcglobal/usdc1/report/All_Bills/" + billdata.ID + "/External_Invoice/download"
			type :GET
			connection:"zoho_oauth_connection"
		];
		file.setparamname("attachment");
		info "download files " + file;
		response = invokeurl
		[
			url :"https://www.zohoapis.in/books/v3/bills/" + bills_id + "/attachment?organization_id=60036667486"
			type :POST
			files:file
			connection:"zoho_books_connection1"
		];
		// 		info file;
		billdata.Zoho_Books_Id=bills_id;
		billdata.Total_Invoice_Amount_Incl_GST=total1;
		var_bill = var.get("bill").getJSON("reference_number");
		info "var_bill" + var_bill;
		// 		openUrl("#Report:Associated_Bill?Internal_Invoice_ID=" + var_bill,"same window");
		iternal_inv = Internal_Invoice[ID == billdata.Bill_Id1];
		iternal_inv.Balance_Amount=billdata.Balance_Amount;
		// iternal_inv.Total_Amount=input.Total_Amount;
		iternal_inv.Total_Amount=ifnull(iternal_inv.Total_Amount,0) + billdata.Total_Amount;
		iternal_inv.Balance_Amount=billdata.Accumulated_Commission_Amount - ifnull(iternal_inv.Total_Amount,0);
		iternal_inv.External_Invoice="";
		iternal_inv.Status="New";
		/*Sending mail to CP*/
		// 		sendmail
		// 		[
		// 			from :zoho.adminuserid
		// 			to :billdata.CP_Details1.Partner_Entity_Name,"vimal@techvaria.com"
		// 			subject :"CP Invoice Verification Successfull"
		// 			message :"CP invoice Verification Done and Submitted to Finance team"
		// 		]
		totalAmount = 0;
		item_list = List();
		hard_lst = {1,2};
		for each  split in hard_lst
		{
			if(split == 1)
			{
				get_creator_amount = billdata.Total_Amount;
				get_credit_debit = "debit";
				get_creator_Description = "Comments";
				item_map = Map();
				item_map.put("amount",get_creator_amount);
				item_map.put("debit_or_credit",get_credit_debit);
				item_map.put("account_id",2293182000000114065);
				// 				2293182000000114073
				item_map.put("customer_id",book);
			}
			if(split == 2)
			{
				get_creator_amount = billdata.Total_Amount;
				get_credit_debit = "credit";
				get_creator_Description = "Test";
				item_map = Map();
				item_map.put("amount",get_creator_amount);
				item_map.put("debit_or_credit",get_credit_debit);
				item_map.put("account_id",2293182000000114073);
				item_map.put("customer_id",book);
			}
			item_list.add(item_map);
		}
		mymap = Map();
		if(billdata.Contracting_organisation == "USDC")
		{
			mymap.put("branch_id",2293182000000188007);
		}
		if(billdata.Contracting_organisation == "Jain University")
		{
			mymap.put("branch_id",2293182000000188048);
		}
		mymap.put("journal_date",zoho.currentdate.toString("yyyy-MM-dd"));
		mymap.put("reference_number",billdata.Order_Number);
		mymap.put("notes","test");
		mymap.put("line_items",item_list);
		mymap.put("total",billdata.Total_Invoice_Amount_Incl_GST);
		//mymap.put("tax_total",billdata.GST_Amount);
		responseBooks = invokeurl
		[
			url :"https://www.zohoapis.in/books/v3/journals?organization_id=60036667486"
			type :POST
			parameters:mymap.toString()
			connection:"zoho_books_connection1"
		];
		getJournal = responseBooks.get("journal");
		Zoho_Books_ID = getJournal.get("journal_id");
		file = invokeurl
		[
			url :"https://www.zohoapis.in/creator/v2.1/data/centralisedprocurement_usdcglobal/usdc1/report/All_Bills/" + billdata.ID + "/External_Invoice/download"
			type :GET
			connection:"zoho_oauth_connection"
		];
		file.setparamname("attachment");
		response = invokeurl
		[
			url :"https://www.zohoapis.in/books/v3/journals/" + Zoho_Books_ID + "/attachment?organization_id=60036667486"
			type :POST
			files:file
			connection:"zoho_books_connection1"
		];
	}
	else
	{
		for each  recs123 in billcreateform.CP_Internal_Invoice_Backend
		{
			recs123.Bill_Creation_Status="No";
			recs123.Bill_Creation_Error_Message=var;
		}
		billcreateform.Bill_Creation_Status="No";
		billcreateform.Bill_Creation_Error_Message=var;
		billdata.Bill_Creation_Status="No";
		billdata.Bill_Creation_Error_Message=var;
	}
}
var_org = organization.get("organization_id");
aaa = vendor_payment.get("payment_id");
amount = vendor_payment.get("amount");
paymentnumber = vendor_payment.get("payment_number");
dateformatted = vendor_payment.getJSON("date_formatted");
branch = vendor_payment.getJSON("branch_name");
refno = vendor_payment.getJSON("reference_number");
//billID = vendor_payment.get("bills").get(0).get("bill_id");
tbill = vendor_payment.getJSON("bills");
resp = invokeurl
[
	url :"https://www.zohoapis.in/books/v3/vendorpayments/" + aaa + "?organization_id=" + var_org
	type :GET
	connection:"books"
];
// info resp;
item_list = List();
for each  rec in tbill
{
	billID = rec.get("bill_id");
	billnum = rec.get("bill_number");
	amtapp = rec.get("amount_applied");
	// Get amount from the bill
	paymentid = rec.get("bill_payment_id");
	info "PAYMENTID: " + paymentid;
	info "AmtApp: " + amtapp;
	// Store amount in item_map for tracking
	item_map = Map();
	item_map.put("Bill_ID",billID);
	item_map.put("Payment_Amount",amtapp);
	item_map.put("Payment_Utr",zoho.currentdate);
	item_map.put("Payment_Number",paymentnumber);
	item_map.put("Branch",branch);
	item_map.put("Reference_Number",refno);
	item_list.add(item_map);
	response = invokeurl
	[
		url :"https://www.zohoapis.in/creator/v2.1/data/centralisedprocurement_usdcglobal/usdc1/report/All_Bills?Zoho_Books_Id=" + billID
		type :GET
		connection:"creator"
	];
	payres = invokeurl
	[
		url :"https://www.zohoapis.in/creator/v2.1/data/centralisedprocurement_usdcglobal/usdc1/report/All_Payments?Bill_Payment_ID=" + paymentid
		type :GET
		connection:"creator"
	];
	payvar = payres.get("data");
	varre = response.get("data");
	booksbilldata = zoho.books.getRecordsByID("bills","60036667486",billID,"books");
	crtrid = booksbilldata.getJSON("bill").getJSON("custom_fields");
	//info "BooksData"+booksbilldata;
	amount = booksbilldata.getJSON("payments");
	//info "Amount"+billID;
	for each  cfid in crtrid
	{
		if(cfid.getJSON("field_id") == "2293182000002730100")
		{
			crtrinvid = cfid.getJSON("value_formatted");
			info "INVID" + crtrinvid;
		}
	}
	// If payment record does not exist, create a new one	
	if(payvar.size() == 0)
	{
		creator_id1 = varre.getJSON("ID");
		paymap = Map();
		paymap.put("Payment_Amount",amtapp);
		paymap.put("Bill_ID",billID);
		paymap.put("Bill_No",billnum);
		paymap.put("Payment_Utr",zoho.currentdate);
		paymap.put("Payment_Number",paymentnumber);
		paymap.put("Branch",branch);
		paymap.put("Bill_Payment_ID",paymentid);
		paymap.put("Reference_Number",refno);
		paymap.put("Zoho_book_id",aaa);
		paymap.put("Bills",creator_id1);
		paymap.put("Zoho_book_id",aaa);
		paymap.put("CP_Internal_Invoice_ID",crtrinvid);
		info "Creating Payment Record: " + paymap;
		otherParams = Map();
		createPaymentres = zoho.creator.createRecord("centralisedprocurement_usdcglobal","usdc1","Payment_form",paymap,otherParams,"creator");
	}
	else
	{
		upmap = Map();
		upothermap = Map();
		getpaymentResponse1 = zoho.creator.getRecords("centralisedprocurement_usdcglobal","usdc1","All_Payments","Bill_Payment_ID ==\"" + paymentid + "\"",1,200,"creator");
		newresponse1 = getpaymentResponse1.getJson("data");
		upmap.put("Payment_Amount",amtapp);
		upmap.put("Bill_ID",billID);
		upmap.put("CP_Internal_Invoice_ID",crtrinvid);
		updatePayment1 = zoho.creator.updateRecord("centralisedprocurement_usdcglobal","usdc1","All_Payments",newresponse1.getJson("ID"),upmap,upothermap,"creator");
		info "Updated Payment Record: " + updatePayment1;
	}
	resp1 = invokeurl
	[
		url :"https://www.zohoapis.in/creator/v2.1/data/centralisedprocurement_usdcglobal/usdc1/report/Associated_Bill?ID=" + crtrinvid
		type :GET
		connection:"creator"
	];
	if(resp1.get("code") == 3000)
	{
		info "RESP1" + resp1;
		pdamt = resp1.getJSON("data").getJSON("Paid_Amount").toNumber();
		pdamt = pdamt + amtapp.toDecimal();
		info "PaidAMOUNT" + pdamt;
		mps = Map();
		Other = Map();
		//mps.put("Paid_Amount",amtapp.toDecimal().round(2));
		// 	info mps;
		upcreatorrec = zoho.creator.updateRecord("centralisedprocurement_usdcglobal","usdc1","Admin_Associated_Bill",crtrinvid,mps,Other,"creator");
		//info "CRT" + upcreatorrec;
	}
}
sendmail
[
	from :zoho.adminuserid
	to :"pooja.s@techvaria.com"
	subject :"Payment Test"
	message :upcreatorrec + "-" + mps
]
star

Tue Apr 15 2025 07:35:25 GMT+0000 (Coordinated Universal Time) https://www.uniccm.com/blog/how-to-use-sin-cos-tan-and-why-its-useful-for-your-career\

@mollietalbot #onlinecourses

star

Tue Apr 15 2025 06:35:56 GMT+0000 (Coordinated Universal Time) https://www.coinsclone.com/are-clone-scripts-legal-to-use/

@janetbrownjb #areclonescriptslegal #cryptoexchangecompliance #legalcryptoplatforms #clonescriptsexplained #cryptoregulations

star

Mon Apr 14 2025 17:49:18 GMT+0000 (Coordinated Universal Time)

@Hassnain_Abbas #html

star

Mon Apr 14 2025 17:30:20 GMT+0000 (Coordinated Universal Time)

@salam123

star

Mon Apr 14 2025 17:29:04 GMT+0000 (Coordinated Universal Time) https://i.imgur.com/DoWSbG3.png

@Y@sir

star

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

@salam123

star

Mon Apr 14 2025 17:16:09 GMT+0000 (Coordinated Universal Time)

@salam123

star

Mon Apr 14 2025 17:15:37 GMT+0000 (Coordinated Universal Time)

@salam123

star

Mon Apr 14 2025 17:14:03 GMT+0000 (Coordinated Universal Time)

@salam123

star

Mon Apr 14 2025 17:10:56 GMT+0000 (Coordinated Universal Time)

@salam123

star

Mon Apr 14 2025 17:08:25 GMT+0000 (Coordinated Universal Time)

@salam123

star

Mon Apr 14 2025 08:29:49 GMT+0000 (Coordinated Universal Time) https://www.linkedin.com/pulse/deploy-ssrs-reports-using-powershell-d365-fo-shayan-arshi

@Manjunath

star

Sun Apr 13 2025 23:00:56 GMT+0000 (Coordinated Universal Time)

@dannygelf #salesforce #screnflow #formula

star

Sun Apr 13 2025 22:59:22 GMT+0000 (Coordinated Universal Time)

@dannygelf #salesforce #screnflow #formula

star

Sun Apr 13 2025 21:30:10 GMT+0000 (Coordinated Universal Time)

@FOHWellington

star

Sun Apr 13 2025 18:19:22 GMT+0000 (Coordinated Universal Time) https://getgems.io/collection/EQBG-g6ahkAUGWpefWbx-D_9sQ8oWbvy6puuq78U2c4NUDFS/EQB9OVZtapC96xAt6yLf6EZKc02KrBVj7x1XwqXW9fLnub4o

@GADJI123

star

Sun Apr 13 2025 17:06:25 GMT+0000 (Coordinated Universal Time) https://giseo.rkomi.ru/app/school/studentdiary/

@nikitos06062011

star

Sun Apr 13 2025 17:03:37 GMT+0000 (Coordinated Universal Time) https://giseo.rkomi.ru/app/school/studentdiary/

@nikitos06062011

star

Sun Apr 13 2025 07:31:07 GMT+0000 (Coordinated Universal Time)

@manish23 #flutter

star

Sun Apr 13 2025 07:26:36 GMT+0000 (Coordinated Universal Time)

@manish23 #flutter

star

Sun Apr 13 2025 07:24:41 GMT+0000 (Coordinated Universal Time)

@manish23 #flutter

star

Sun Apr 13 2025 07:21:10 GMT+0000 (Coordinated Universal Time)

@manish23 #flutter

star

Sun Apr 13 2025 07:17:57 GMT+0000 (Coordinated Universal Time)

@manish23 #flutter

star

Sat Apr 12 2025 22:26:36 GMT+0000 (Coordinated Universal Time) https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo

@Mido4477

star

Sat Apr 12 2025 21:08:15 GMT+0000 (Coordinated Universal Time)

@v1ral_ITS

star

Sat Apr 12 2025 17:18:40 GMT+0000 (Coordinated Universal Time)

@freepythoncode ##python #coding #python #forloop

star

Sat Apr 12 2025 12:49:08 GMT+0000 (Coordinated Universal Time) https://www.beleaftechnologies.com/amazon-clone

@raydensmith #amazon #clone #e-commerce

star

Fri Apr 11 2025 21:53:35 GMT+0000 (Coordinated Universal Time)

@gbritgs

star

Fri Apr 11 2025 10:25:29 GMT+0000 (Coordinated Universal Time) https://www.coinsclone.com/best-crypto-wallets/

@CharleenStewar #top10cryptowallets #bestcryptowallets #cryptobusiness

star

Fri Apr 11 2025 10:07:23 GMT+0000 (Coordinated Universal Time) https://www.kryptobees.com/blog/fantasy-sports-app-development

@Franklinclas

star

Fri Apr 11 2025 10:05:51 GMT+0000 (Coordinated Universal Time) https://www.groupteamwork.com/pr-agency-in-delhi/

@smriti1133 #prcompany in delhi #bestpr agency in delhi #prfirms in delhi #publicrelations agency in delhi #publicrelations firm in delhi

star

Fri Apr 11 2025 09:26:58 GMT+0000 (Coordinated Universal Time) https://www.coinsqueens.com/blog/bet365-clone-script

@athenapetridis #gaming #bet365clone #scinlinebetting

star

Fri Apr 11 2025 07:29:35 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 05:05:18 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 04:25:47 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 04:21:27 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 04:20:21 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 04:19:16 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 04:17:44 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 04:16:48 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 04:15:45 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 04:14:01 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 04:10:48 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 04:09:34 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 04:08:41 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 04:06:28 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 04:05:59 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 04:05:10 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 04:03:22 GMT+0000 (Coordinated Universal Time)

@Pooja

star

Fri Apr 11 2025 03:56:56 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