Calculating AM and PM hours

I have a table that stores time slots.
1. One field is called available_time (and is a number field and need to be converted to hours/minutes).
2. There are 2 other date/time fields as well - these being start_time and end_time.
Here is where I am having problems.
Anything before 12 noon is AM, after is PM. If any slots run from AM to PM then I need to use the start and end times and split the time into AM and PM eg start 05/01/2012 07:30:00 and end 05/01/2012 13:04:00 I need to do 05/01/2012 12:00:00-05/01/2012 07:30:00 to get AM and 05/01/2012 13:04:00-05/01/2012 12:00:00 to get PM.
Below shows the kind of layout I'm looking for in my report.
Any help would be greatly appreciated.
PS I am using Oracle Database 11g and Oracle Developer Suite 10g (reports)
Team Leader: ID and Name
Senior: ID and Name
Carer ID     Name          Date          AM          PM     Total
11111     Person 1          02/03/2012     2:20          3:30     5:50
11111     Person 1          03/03/2012     4:00          4:00     8:00
Carer ID     Name          Date          AM          PM     Total
22222     Person 2          02/03/2012     3:00          3:00     6:00
22222     Person 2          03/03/2012     4:00          4:00     8:00
Team Leader: ID and Name
Senior: ID and Name
Carer ID     Name          Date          AM          PM     Total
33333     Person 3          02/03/2012     3:00          3:00     6:00
33333     Person 3          03/03/2012     4:00          4:00     8:00

Thanks,
I have that now using diary_date + 12:00:00.
I'm having problems doing the subtract bit as I'm getting different errors.
One way I do get a result is using the statment below, but it's not identifying between AM and PM
For the example rows below I would need a column called AM free showing (for row 1) 00:00:00 and for PM Free should show 03:45:00 and total showing 03:45:00 (as it is already)
Row 2 would show: AM Free 04:15:00 (this is the difference between 07:45:00 and 12:00:00 noon) and PM Free would show 00:00:00
Row 4 would show AM Free 04:15:00 (difference between 07:45:00 and 12:00:00) and PM Free would be 0045:00 (difference between 12:00:00 and 12:45:00) with TOTAL of 05:00:00 as shown.
But as you can see my DIFF column display incorrectly when no AM time is available as shown in rows 1 and 3.
I hope this makes more sense.
Kind regards.
select s.diary_date, s.start_time, s.end_time,
to_char(to_date('00:00:00','HH24:MI:SS')+ (end_time - start_time), 'HH24:MI:SS') TOTAL,
to_date(diary_date || ' 12:00:00', 'DD/MON/YYYY HH:MI:SS') DIARY_DATE_TIME,
to_char(to_date('00:00:00','HH24:MI:SS')+
(to_date(diary_date || ' 12:00:00', 'DD/MON/YYYY HH24:MI:SS')- start_time), 'HH24:MI:SS') DIFF
from rhm_op_available_slots s
     DIARY_DATE     START_TIME     END_TIME     TOTAL     DIARY_DATE_TIME     DIFF
1     14/03/2007     14/03/2007 12:30:00     14/03/2007 16:15:00     03:45:00     14/03/0007 12:00:00     23:30:00
2     15/03/2007     15/03/2007 07:45:00     15/03/2007 12:00:00     04:15:00     15/03/0007 12:00:00     04:15:00
3     15/03/2007     15/03/2007 12:30:00     15/03/2007 16:15:00     03:45:00     15/03/0007 12:00:00     23:30:00
4     16/03/2007     16/03/2007 07:45:00     16/03/2007 12:45:00     05:00:00     16/03/0007 12:00:00     04:15:00

Similar Messages

  • Advanced Calculation Options and Assignments Calculating Erratically - Project Professional 2013

    I have run into something strange in Project Professional 2013 when dealing with the Advanced Calculation Options and Assignment % Work Complete, and I believe that it is a bug.
    I will demonstrate in a simple example.
    Open a Brand New Project.
    Create a single Auto Scheduled Task with Two Resources. (I used Tom and Jerry.) Give it a couple weeks of duration (I gave mine 10 days)
    Go to the Options, Advanced Page, and Select the Move end of completed parts after status date back to status date option.
    Set a status date a few days after the task start date.
    Now, Go to the Task Usage View.  Add a % Work Complete Column, and an Actual Work Row.
    Save that so that you can load it from scratch.
    Now for the inconsistent Part:
    First, Try entering 25% for the Task's % Work Complete.
    Everything is correct, right? But let's say that Jerry actually had completed 30% of his task. Change Jerry's to 30%.
    This is correct also. But I was talking about assignment management, not task management.
    So, lets try it that way. Click on Undo a few times or just reload the file you saved to get back to the first state. If you undo, make sure that you don't undo your status date or Advanced Calculation Setting.
    This time, instead of entering a Task % Work complete, enter Assignment % Work Completes of 25% for Tom and 30% for Jerry.
    Notice that the moment you enter the 25% for Tom, it has moved Jerry's start date. Also, when you enter 30% for Jerry, it ignores max units from the resource sheet and calendar for Jerry.
    It should be using the calendar and backing the units for Jerry toward the start of the task. But it doesn't. What it does is move the start date for Jerry's Assignment to the day before the status date, and then, because it has zeroed the Work for the earlier
    days, ignores them (and the calendar and max units) when it starts to assign the work before the status date, and assigns the actual work based on the weighted work scheduled for those days, resulting in the above.
    The main problem with this is: It shouldn't be moving the starting date for the other assignment at all.  If it didn't, the outputs would be the same. I believe that what is actually happening is when a % Work Complete is changed for an assignment,
    the entire task is being re-evaluated, and all assignments are being evaluated also. Note that this happens even if you have the setting Calculate project after each edit set to Off. What should be happening is that only the assignment changed should be evaluated,
    and the task updated with that information.
    Has anyone else had trouble with this, or no? Does anyone have an explanation for this behavior, or is the explanation that the dev team didn't implement assignment calculation correctly for these advanced calculation types? Is this a valid bug, or am I
    missing something? If so, how does it get reported? We do have the work around, entering the task value first, but that seems a bit clunky. They should both be exactly the same, without moving the start date, or ignoring max units  and calendars for the
    resources.
    Any insight?

    I understand Project as follows:
    The move task advanced option is in fact for users that are only going to add a % complete to a task. This at least makes sure there is no incomplete work in the past and no completed work in the future. As you know % complete on its own is a low maturity,
    poor option for updating.
    If updating assignments (good on you) then don't use the move option and enter actual start, actual work and remaining work or enter actual hours in the timephased part of a usage view.
    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

  • I am transfering my stuff from my lap top to my desk top (both Mac). I cannot get my CS4 to open. It gives me a 150:30 error, licencing thing. I have no idea what to do and after hours of searching none of what I found helps. I don't know anything about t

    Sorry didn't know that the first step was just supposed to be "subject".
    So here it is again.
    "I am transfering my stuff from my lap top to my desk top (both Mac). I cannot get my CS4 to open. It gives me a 150:30 error, licencing thing. I have no idea what to do and after hours of searching none of what I found helps. I don't know anything about this stuff so please don't answer with "maybe this willl work, or maybe that."  I need a real answer please and I cannot find a way to actually contact Adobe. I also don't have a disk drive on this Mac. Thanks"
    Also please feel free to e-mail the answer because I hate looking for these answers online. It takes me forever to find this section. Not that I have even even gotten a real answer.
    [email protected]

    Hi Sonia,
    While transferring Adobe from laptop to PC the licensing files got corrupt and the right way to use Adobe Applications is to install first as transferring from a different machine can give you problems.
    You can try steps from this article if that helps otherwise you have to reinstall and manually delete some files , everything is mentioned.
    http://helpx.adobe.com/x-productkb/global/error-licensing-stopped-mac-os.html
    You can download CS4 from here:
    Download CS4 products

  • How to monitor progress of web-service calculation?  And abort it?

    Hello. We're thinking of converting an existing Java radar calculation program into a web-service, so that it can be used by various interested parties. However, calculations can take some time (several minutes) and so we would like the client to be able to both show calculation progress and allow the user to abort the calculation if necessary. It is not obvious to us how to do this with a web-service. Are there any standard approaches to this problem? What's the best way of a client asking the web-service how a calculation is progressing? What's the best way for a client to abort a calculation? Any advice most welcomed.
    Kind regards
    Paul Howland
    NATO C3 Agency
    The Hague

    You can't estimate the duration withour running the gather_database_stats. You can monitor it while it is running. (e.g. count the tables that have got updated statistics based on DBA_TABLES)
    And if you run gather_database_stats, the default behaviour might well be to exclude tables which aren't "stale" while in the imported database the expectation is to gather stats on all tables.
    (Similarly, the behaviour to gather column histograms (method_opt) may differ in an existing database from a newly imported database)
    Hemant K Chitale
    Edited by: Hemant K Chitale on May 14, 2013 10:13 AM

  • Function module for calculating planned and actual cost of production order

    Hi ,
    Do we have any standard function module for calculating planned and actual cost for production order?
    i need to implement this in a Z-report.
    Thanks
    Srini

    Hi,
    try below function module
    CRMCO_GET_PLAN_ACTUAL_COSTS
    CO_IH_GET_PLANNED_COSTS_TOTAL
    Regards,
    Sankaran

  • Calculating opening and closing stocks at a plant (on specific dates)

    Hi,
    I am to develop an ABAP-report. On the selection screen, I'll have plant, material, and a date range (date_1 and date_2). The report should show opening stock on date_1, closing stock on date_2, and then there is more segregation based on movement types (along with both stock-quantity and stock-value). I am stuck at how-to's around calculating opening (and closing) stock on a particular date.
    Secondly, transaction MB5B has 3 options : batch stock, valuated stock, special stock ... One of these options uses table MBEW and other uses table MARD ... Which (all) tables will I need to use so as to get both stock-quantities and stock-values ?
    Please advise. Thank you.
    Regards,

    Hi
    for second question answer is
    you need to consider all batch stock, valuated stock, special stock ... One of these options uses table MBEW and other uses table MARD to get both stock-quantities and stock-values
    hope it helps
    Edited by: ppkk on Dec 10, 2008 10:58 AM

  • My macbook seems to be going crazy. At certain points (and for hours) I get the oh snap page on chrome, safari doesnt work, macbook wont let me create any files or for example upload music to itunes. I restored my mac so im sure its not a malware problem.

    My macbook seems to be going crazy. At certain points (and for hours) I get the oh snap page on chrome, safari doesnt work, macbook wont let me create any files or for example upload music to itunes. I restored my mac so im sure its not a malware problem. The only thing that solves it is switching off and on , but sometimes I have to do that for 6-7 times before its ok or wait for a few hours. Some help please

    Please read this whole message before doing anything.
    This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
    Step 1
    The purpose of this step is to determine whether the problem is localized to your user account.
    Enable guest logins* and log in as Guest. Don't use the Safari-only “Guest User” login created by “Find My Mac.”
    While logged in as Guest, you won’t have access to any of your personal files or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
    Test while logged in as Guest. Same problem?
    After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
    *Note: If you’ve activated “Find My Mac” or FileVault, then you can’t enable the Guest account. The “Guest User” login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
    Step 2
    The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you turn on the computer, and again when you log in.
    Note: If FileVault is enabled, or if a firmware password is set, or if the startup volume is a Fusion Drive or a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to start up and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal startup may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem?
    After testing, restart as usual (not in safe mode) and verify that you still have the problem. Post the results of Steps 1 and 2.

  • Labor Hours and Machine Hours

    Hi everyone,
    Our manufacturing operation involves injection molded parts that have labor time and machine time structured. As operations department, we receive a daily schedule per molding machine we have but such schedule shows only the amount of parts to be produced and not its equivalent in machine and labor hours based on its routings. Basically we receive a list of Planned Orders to be produce in a daily basis with parts only.
    In a previous experience in Oracle there was a report showing the order, parts, labor time and machine time requiered.
    Is there a report in SAP that can reflect the same data?
    Currently we are looking up into a routings spreadsheet but the problem is that is not accurate because routings may change for multiple reasons.
    Thanks.
    JB

    Jorge,
    This is possible in SAP also. But this needs enabling PP and timebooking functionality in HR.
    In PP along with CO, the machines or the PRT are created as cost centers and teh costs will accrue to these cost centers. Similarly teh cost of the materials can also be accrued on a cost center. The labour hours can be captured by means of timebooking and linking every employee to a work center whichis again linked to a cost center. If these functionalities are enabled, then it is possible to see all the costs, activities and schedules used for an order, may it be production order, assembly order, or a service order.

  • Capture travel time expenses and working hours spent on the service call

    Hi Experts,
    I have One Year AMC contract with my customer.Under AMC he called me for 10 times.I need to
    Capture travel time expenses and working hours spent on all the service call, Non of them will be billed to the customer.
    This is just for our internal tracking.this particular data will reside within the office premises.
    Explain how efficiently we can track this particular requirement in SAP Business One
    Regards,
    Vikram

    Hi Vikram
    You will notice on the item master records that there is a field called Item Type. The options are Item, Labor and Travel. In order for the service module to recognize the expense or charge type, either Labor or Travel must be select. Create a service item (untick inventory item) and choose the Item Type as Labor or Travel. When you now create a Delivery/Invoice from the expenses section of the service call, it will identify and warn you if you charge the customer, as this would be defined in your service contract template as non billable charges. You can still create a Delivery for the charges and put quantities and values on the Delivery document. In this case you are not going to invoice the customer for the charges, so you can "Close" the Delivery. Just be aware that closing the Delivery will post the value to an offset account defined in the Account Determination.
    The benefit of this approach is that the Delivery will post a debit and credit in your G/L that will "accrue" what the costs are of servicing the customer. My suggestion would be to set the account determination for the Labor/Travel item(s) to item level and define the Revenue/Expense accounts to specific G/L accounts.
    Let me know if you need more information or assistance with the above.
    Kind regards
    Peter Juby

  • Run Time Hours and Active Hours

    Hello all,
    I've been trying to work up some reports regarding use of certain applications and I don't quite understand how ZAM actually generates the information for Run Time Hours and Active Hours of say Microsoft Access. Or what these options really mean.
    Also, with a PC that may have mulitple users (all with their own user accounts), does it take a cumulative count of 'usage' of applications or is it based on a per user basis. And if it is per user, does that mean it will only report on the user that happened to be logged in on the PC when it was 'scanned' for the week?
    Any help would be greatly appreciated.
    Thanks
    JH

    Originally Posted by jehegarty
    Hello all,
    I've been trying to work up some reports regarding use of certain applications and I don't quite understand how ZAM actually generates the information for Run Time Hours and Active Hours of say Microsoft Access. Or what these options really mean.
    Also, with a PC that may have mulitple users (all with their own user accounts), does it take a cumulative count of 'usage' of applications or is it based on a per user basis. And if it is per user, does that mean it will only report on the user that happened to be logged in on the PC when it was 'scanned' for the week?
    Any help would be greatly appreciated.
    Thanks
    JH

  • I Can't lock an entity that has "OK" calculation status and "Published" review level

    The problem into the HFM aplication is that I have to lock the actual period but one entity has "OK" calculation status and "Published" review level; when I clic "lock" on the entity, the system send a message "The process Unit cannot be locked if it needs to be calculated, translated, or consolidated"
    Thank you

    Check the Other Value dimensions.  Locks are value specific(So locking Entity Currency doesn't necessarily lock Parent Currency).  Make sure all the value dimensions are at OK status.

  • Alternative calculation type and alternative condition base value

    In pricing procedure what is the difference between alternative calculation type and alternative condition base value?Kindly help

    Hi,
    Please check the forum before you post your questions as this question was answered a number of times earlier.
    Please check the below link which discusses in detail regarding the same.
    [Alt Cal Type and Cond Base Value|Alternative calculation type and alterantive condition base value in pricin;
    Regards,
    Phani Prasad

  • Requirement type, alternative calculation type and alternative base value?

    Hi guys pls can any body experts in pricing
    Can u pls explain requirement type, alternative calculation type and alternative base value?
    Not theory Any of Ur real time experience………

    <b>Requirement:</b>
    It is a routine that is written by an ABAP consultant according to the business requirement.
    By defining Requirement in condition technique we can restrict the access of condition type.
    To understand the concept, we will take the example of the Rebates. Rebates are to be included during the billing document processing and not in the sales document processing. As rebates are given on the delivered quantity and not on the ordered quantity (in case of cut-off period for rebates).
    For rebates we use the condition types BO01 to BO05, and in the Requirement column we give the value 24 which is "Only in Billing Document".
    This Requirement will ensure that these condition types will appear only during the billing document processing.
    If new Requirements are to be defined we follow the procedure given below.
    Go to T.Code: VOFM. - Maintain Requirements & Formulas
    Click on the "Requirements" in the top menu and then click on "pricing".
    We have a list of requirements, we can ask ABAP consultant to create new requirement based on the client requests.
    And we assign the application type like V - Sales/Distribution etc.
    <b>AltCty - Condition formula for alternative calculation type:</b>
    It is again a Routine that is written by ABAP Consultant.
    It is an alternative formula for the condition type that can be used instead of standard formulas.
    For example, let us take the Profit Margin which can be both + / - , so here this routine will help us in generating the value which can be either + or -. Profit margin is not a condition type so it cannot be classified as +ve or -ve in the V/06.
    Ex.: 950 0 Profit Margin 11.
    So we assign 11 - Profit Margin.
    If new routines are to be defined we follow the procedure given below.
    Go to T.Code: VOFM. - Maintain Requirements & Formulas
    Click on the "Formulas" and then on the "Condition Values".
    We have a list of routines, we can ask ABAP consultant to create new routines based on the client requests.
    And we assign the application type.
    <b>AltCBV - Alternative formula for condition base value:</b>
    Formula for determining the condition basis as an alternative to the standard.
    It is again a Routine that is written by ABAP Consultant.
    It is used as a basis to calculate value of the condition type instead of using it from the "FROM" column.
    Ex.: Freight - KF00.
    Freight is calculated based on weight, volume etc. and not on the base price. In pricing there is no entry of weight from which the value can be referred like we do for discounts using base price. We have to get the value from the Material master.
    In this column we can mention the value as 12 - Gross Weight or 13 - Net Weight.
    During pricing, the system will consider the value that is mentioned in this column and determine the freight based on this value.
    Suppose we have Net weight: 100 kgs and Gross Weight: 150 kgs. And if we mention 13 in this column then the Freight condition KF00 will be calculated using the weight as 100 kgs.
    Regards
    AK

  • Alternate calculation type and alternate base value

    hi all,
    please guide me the concept of alternate calculation type and alternate base value

    Hi,
    ALTERNATE CALCULATION TYPE:  
          This  function allows you use a formula as an alternative in finding the value of the  condition type,
    instead of standard condition technique. this can be used to  calculate complex tax structures. 
    ALTERNATE CONDITION BASE VALUE:
          The  alternative condition base value is a formula assigned to a condition type in  order to promote an alternative base value for the calculation of a  value.
    And Refer this link.
    http://sapsdforum.com/2007/09/05/pricing-alternate-calculation-type-alt-condition-base-value-and-requirements/
    Hope it helps you,
    Regards,
    Ravindra.

  • I bought a iphone 3gs 4 months ago had a problem with display service centre replaced me with the phone when i checked the settings of the phone in cellular usage under call time the lifetime usage was 3 days and 18 hours.what sholud be done ?

    i bought a iphone 3gs 4 months ago had a problem with display service centre replaced me with the phone when i checked the settings of the phone in cellular usage under call time the lifetime usage was 3 days and 18 hours.what sholud be done ?

    How is your iPhone's display different?
    You can check the model number by  going to Settings/General/About. These are the model numbers for the various 3 GS models;
    MB715LL/A (16 GB Black), MB716LL/A (16 GB White), MB717LL/A (32 GB Black), MB718LL/A (32 GB White), MC555LL/A (8GB)

Maybe you are looking for