Skip to content

Instantly share code, notes, and snippets.

View mabsboza's full-sized avatar
🤙

JamesCode mabsboza

🤙
View GitHub Profile
// Function to format amounts with commas and 2 decimals
const FormatToLocalString = (num) => {
if (num === null || undefined) {
return num = 0.00;
} else {
//Check if amount is float.
let isFloat = Number(num) === num && num % 1 !== 0;
if (isFloat) {
// Format amount with 2 decimals
num = Math.round(num * 100) / 100;
old_stock = Inventory::StockByWarehouse.where(master_data_item: master_data_item)
.where(' warehouse_id in (?)', warehouses_ids)
.select('sum(physical_quantity) as physical_quantity,
sum(reserved_quantity) as reserved_quantity')
old_total = old_stock[0].physical_quantity.nil? ? 0 : (old_stock[0].physical_quantity * master_data_item.unit_cost)
buy = (transaction_cost * quantity)
new_cost = 0
cat > UpdateExpenseOrderTotal.rb
a = load "#{Rails.root}/UpdateExpenseOrderTotal.rb"
a = UpdateExpenseOrderTotal
a.new('tenant').run
class UpdateExpenseOrderTotal
def initialize(tenant)
@tenant = tenant
end
class UpdateExpenseOrderSummary
def initialize(id:)
Apartment::Tenant.switch! 'aidelrio'
@order_id = id
update_finance_order_summary
end
def get_all_expense_orders
Finance::ExpenseOrder.where(id: @order_id)
<Form.Item
name="workOrderType"
label={
<Tooltip
title={
<FormattedMessage
id="activities.workOrderType.hint"
defaultMessage="hint"
/>
# Description
Please include a summary of the change and which issue is fixed or feature, include relevant context and List any dependencies that are required for this change.
Feature/Fix # [(Referenced card)](URL)
## Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
import React, { useState } from 'react';
import { slice } from 'lodash';
import { ArrowRightOutlined } from '@ant-design/icons';
import {
Button,
Col,
Divider,
Row,
Typography,
} from 'antd';
ContractorWorker.all.each do |worker|
worker_status = if worker.banished_at?
ContractorWorker::Status::DISABLED
elsif !worker.approved?
ContractorWorker::Status::REJECTED
elsif worker.approved? && worker.without_access
ContractorWorker::Status::INCOMPLETE
elsif worker.approved? && !worker.without_access
ContractorWorker::Status::APPROVED
import React from 'react'
import User from '../User'
function Welcome() {
return (
<div className="Welcome">
Welcome page rendered after login
class DeactivateInactiveContractorWorkers
def perform
Site.where(app: 'mall').includes(staffing_contractors: :non_archived_jobs).each do |site|
next unless site.contractor_worker_expiration_days
@expiration_days = site.contractor_worker_expiration_days
site.staffing_contractors do |contractor|
next if has_active_job?(contractor)
active_contractor_workers = contractor.alive_contractor_workers